-
Notifications
You must be signed in to change notification settings - Fork 115
Public Sequencer: Add automation to revoke ParticipantSynchronizerPermission based on ValidatorUnpermision. Extend integration test to to check both temporary revocation and permanent revocation #6953
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
Merged
pasindutennage-da
merged 7 commits into
feature-public-sequencer-and-scan
from
pasindutennage-da/fix/6938
Aug 27, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
13c2c61
Public Sequencer: Add automation to revoke ParticipantSynchronizerPer…
pasindutennage-da 7fa4f18
Fixed AssignedContractTrigger 2026 Aug 25 16.12
pasindutennage-da 3cf46a5
Addressed comments
pasindutennage-da fa6773a
Logger supress
pasindutennage-da a689c8c
stop bob
pasindutennage-da 1fb3668
Addressed Feedback
pasindutennage-da 6267f45
Trigger CI
pasindutennage-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
99 changes: 99 additions & 0 deletions
99
...in/scala/org/lfdecentralizedtrust/splice/sv/automation/ValidatorUnpermissionTrigger.scala
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 |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| // Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package org.lfdecentralizedtrust.splice.sv.automation | ||
|
|
||
| import com.digitalasset.canton.data.CantonTimestamp | ||
| import com.digitalasset.canton.topology.{ParticipantId, SynchronizerId} | ||
| import com.digitalasset.canton.topology.transaction.ParticipantPermission.Submission | ||
| import com.digitalasset.canton.tracing.TraceContext | ||
| import io.opentelemetry.api.trace.Tracer | ||
| import org.apache.pekko.stream.Materializer | ||
| import org.lfdecentralizedtrust.splice.automation.{ | ||
| OnAssignedContractTrigger, | ||
| TaskOutcome, | ||
| TaskSuccess, | ||
| TriggerContext, | ||
| } | ||
| import org.lfdecentralizedtrust.splice.codegen.java.splice.validatorunpermission.ValidatorUnpermission | ||
| import org.lfdecentralizedtrust.splice.environment.{ParticipantAdminConnection, RetryFor} | ||
| import org.lfdecentralizedtrust.splice.sv.store.SvDsoStore | ||
| import org.lfdecentralizedtrust.splice.util.AssignedContract | ||
|
|
||
| import scala.concurrent.{ExecutionContext, Future} | ||
| import scala.jdk.OptionConverters.* | ||
|
|
||
| class ValidatorUnpermissionTrigger( | ||
| override protected val context: TriggerContext, | ||
| store: SvDsoStore, | ||
| participantAdminConnection: ParticipantAdminConnection, | ||
| )(implicit | ||
| override val ec: ExecutionContext, | ||
| mat: Materializer, | ||
| tracer: Tracer, | ||
| ) extends OnAssignedContractTrigger.Template[ | ||
| ValidatorUnpermission.ContractId, | ||
| ValidatorUnpermission, | ||
| ]( | ||
| store, | ||
| ValidatorUnpermission.COMPANION, | ||
| ) { | ||
|
|
||
| override protected def completeTask( | ||
| unpermission: AssignedContract[ValidatorUnpermission.ContractId, ValidatorUnpermission] | ||
| )(implicit tc: TraceContext): Future[TaskOutcome] = { | ||
| val payload = unpermission.payload | ||
|
|
||
| ParticipantId | ||
| .fromProtoPrimitive(payload.participantId, "participantId") | ||
| .fold( | ||
| err => | ||
| Future.successful( | ||
| TaskSuccess(s"Skipping ValidatorUnpermission with invalid participantId: $err") | ||
| ), | ||
| participantId => { | ||
| for { | ||
| dsoRules <- store.getDsoRules() | ||
| synchronizerId = SynchronizerId.tryFromString( | ||
| dsoRules.payload.config.decentralizedSynchronizer.activeSynchronizerId | ||
| ) | ||
|
|
||
| outcome <- | ||
| if (payload.revoked) { | ||
| participantAdminConnection | ||
| .ensureParticipantSynchronizerPermissionRemoved( | ||
| synchronizerId, | ||
| participantId, | ||
| ) | ||
| .map { _ => | ||
| TaskSuccess( | ||
| s"Permanently revoked ParticipantSynchronizerPermission for participant $participantId" | ||
| ) | ||
| } | ||
| } else { | ||
| for { | ||
| existingMappings <- participantAdminConnection | ||
| .listParticipantSynchronizerPermission( | ||
| synchronizerId, | ||
| participantId.filterString, | ||
| ) | ||
|
|
||
| _ <- participantAdminConnection.ensureParticipantSynchronizerPermission( | ||
| synchronizerId = synchronizerId, | ||
| participantId = participantId, | ||
| permission = Submission, | ||
| retryFor = RetryFor.Automation, | ||
| limits = existingMappings.headOption.flatMap(_.mapping.limits), | ||
| loginAfter = payload.loginAfter.toScala | ||
| .map(t => CantonTimestamp.assertFromInstant(t)), | ||
| ) | ||
| } yield TaskSuccess( | ||
| s"Temporarily revoked ParticipantSynchronizerPermission for participant $participantId (loginAfter: ${payload.loginAfter.toScala | ||
| .map(t => CantonTimestamp.assertFromInstant(t))})" | ||
| ) | ||
| } | ||
| } yield outcome | ||
| }, | ||
| ) | ||
| } | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.