Skip to content

Add support to automatically copy votes between SVs [ci] (#3084)#4691

Open
ericmann wants to merge 6 commits intohyperledger-labs:mainfrom
Avro-Digital:eric-avro/copy-votes-between-svs/3084
Open

Add support to automatically copy votes between SVs [ci] (#3084)#4691
ericmann wants to merge 6 commits intohyperledger-labs:mainfrom
Avro-Digital:eric-avro/copy-votes-between-svs/3084

Conversation

@ericmann
Copy link
Copy Markdown
Contributor

Adds a copyVotesFrom configuration option to SvAppBackendConfig that enables automatic copying of governance votes (VoteRequests) from a named source SV. This supports the use case where an operator runs multiple SV nodes and wants votes kept in sync between them.

The implementation follows the established ScheduledTaskTrigger pattern (modeled after FollowAmuletConversionRateFeedTrigger). When configured, a new CopyVotesTrigger polls for VoteRequests where the source SV has voted but this SV has not, and automatically casts a matching vote with the same accept/reject decision and reason.

Configuration example:

copy-votes-from = "Digital-Asset-2"

Changes:

  • SvAppConfig.scala: Add copyVotesFrom: Option[String] to SvAppBackendConfig
  • CopyVotesTrigger.scala: New ScheduledTaskTrigger implementation
  • SvDsoAutomationService.scala: Conditional trigger registration + expectedTriggerClasses
  • CopyVotesTimeBasedIntegrationTest.scala: Integration tests covering accept/reject vote copying, idempotency, and no-op when source SV hasn't voted

Fixes #3084

Pull Request Checklist

PR Guidelines

  • Include any change that might be observable by our partners or affect their deployment in the release notes.
  • Specify fixed issues with Fixes #n, and mention issues worked on using #n

Merge Guidelines

  • Make the git commit message look sensible when squash-merging on GitHub (most likely: just copy your PR description).

Adds an optional `copyVotesFrom: Option[String]` field that specifies
the name of another SV whose governance votes should be automatically
copied. This supports the use case where an operator runs multiple SV
nodes and wants votes kept in sync.

Resolves: hyperledger-labs#3084

Signed-off-by: Eric Mann <eric@avrofi.com>
Implements a ScheduledTaskTrigger that polls for VoteRequests where a
configured source SV has voted but this SV has not, then automatically
casts a matching vote (same accept/reject decision and reason).

The trigger resolves SV names via DsoRules.svs and uses the VoteRequest
tracking CID pattern to handle contract ID changes between polling and
submission.

Resolves: hyperledger-labs#3084

Signed-off-by: Eric Mann <eric@avrofi.com>
Conditionally registers the trigger when copyVotesFrom config is set,
and adds it to expectedTriggerClasses for trigger validation.

Signed-off-by: Eric Mann <eric@avrofi.com>
Tests three scenarios with sv2 configured to copy votes from sv1:
- Source SV creates a vote request and trigger copies the accept vote,
  including idempotency on re-run
- Source SV casts a reject vote and trigger copies it correctly
- Source SV has not voted yet so trigger produces no tasks

Signed-off-by: Eric Mann <eric@avrofi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support to automatically copy votes between SVs

5 participants