Skip to content

Conversation

arepala-uml
Copy link
Contributor

  1. Implemented Voter.ToPlutusData(), Vote.ToPlutusData(), and VotingProcedure.ToPlutusData() methods.
  2. Converts voter types (Constitutional Committee/DRep/Staking Pool) to PlutusData by wrapping hashes in StakeCredential structures with different constructor numbers (0/1/2).
  3. Created gov_test.go with test coverage for all three types, testing all voter types, vote types.

Closes #1105

…otingProcedure types and written test functions as well

Signed-off-by: Akhil Repala <[email protected]>
@arepala-uml arepala-uml marked this pull request as ready for review July 28, 2025 00:26
@arepala-uml arepala-uml requested a review from a team as a code owner July 28, 2025 00:26
@arepala-uml arepala-uml requested review from wolf31o2 and agaffney July 28, 2025 00:26
case Vote(GovVoteAbstain):
return data.NewConstr(2)
default:
return data.NewConstr(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should return nil if we don't know the proper representation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the changes and please review it.

case VoterTypeStakingPoolKeyHash:
return data.NewConstr(2, data.NewByteString(v.Hash[:]))
default:
return data.NewConstr(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return nil

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the changes and please review it.

@arepala-uml arepala-uml requested a review from agaffney July 28, 2025 02:51
@agaffney agaffney merged commit 1c7eca1 into main Jul 28, 2025
8 checks passed
@agaffney agaffney deleted the plutus_vote branch July 28, 2025 12:29
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 ToPlutusData() function to gov vote-related types
2 participants