Skip to content
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

[PVM, DAC] Txs and proposals #67

Merged
merged 1 commit into from
Jan 22, 2024
Merged

[PVM, DAC] Txs and proposals #67

merged 1 commit into from
Jan 22, 2024

Conversation

evlekht
Copy link
Member

@evlekht evlekht commented Aug 14, 2023

Why this should be merged

This PR adds support for DAC voting feature txs, which includes txs indexing and 2 api requests: /proposals? and /proposals/:id/votes

How this works

Added txs:

  • AddProposalTx
  • AddVoteTx
  • FinishProposalsTx

Added proposals and their magellan types:

  • AdminProposal
  • BaseFeeProposal (0)
  • AddMemberProposal (1)
  • ExcludeMemberProposal (2)
  • GeneralProposal (3)
  • FeeDistributionProposal (4)

Admin proposal is flag in proposals table.

PR adds new tables: dac-proposals and dac-votes.
When magellan indexes new tx, if its addProposalTx, it will insert new row into proposals table. If its addVoteTx, then it will insert new row into votes table.
Proposals table also contains serialized proposalState from proposal. This state is updated whenever addVoteTx is indexed. Its required to have correct proposal outcome.

Proposal has state and outcome. Outcome is some arbitrary byte returned by proposal.Outcome(), only expected from successful proposals. State is one of following: 0 - in progress (could be still inactive if its before start-time, but thats not tracked in magellan), 1 - successful, 2 - failed.

Proposal state and outcome are updated, when finishProposalsTx is indexed.

How this was tested

Unit-tests, manual tests with local node and db exploring.

@evlekht evlekht force-pushed the evlekht/dac branch 2 times, most recently from 24c0fdd to 5a9f0e1 Compare August 14, 2023 15:00
@evlekht evlekht marked this pull request as ready for review August 14, 2023 15:13
@evlekht evlekht changed the title [PVM][Dependencies] AddProposalTx, AddVoteTx, FinishProposalsTx [PVM, Dependencies] AddProposalTx, AddVoteTx, FinishProposalsTx Aug 15, 2023
@evlekht evlekht force-pushed the evlekht/dac branch 4 times, most recently from 893e0eb to ab94af2 Compare August 16, 2023 14:37
@knikos knikos self-requested a review August 17, 2023 13:50
knikos
knikos previously approved these changes Aug 17, 2023
db/dbmodel.go Outdated Show resolved Hide resolved
db/dbmodel_test.go Outdated Show resolved Hide resolved
services/indexes/params/collections.go Show resolved Hide resolved
@evlekht evlekht force-pushed the evlekht/dac branch 3 times, most recently from 82caefb to 06023f8 Compare August 18, 2023 12:55
@evlekht evlekht force-pushed the evlekht/dac branch 9 times, most recently from 20b4b9c to 78e901a Compare September 6, 2023 07:34
@evlekht evlekht force-pushed the evlekht/dac branch 3 times, most recently from 7eee782 to d0b34b8 Compare September 11, 2023 18:51
@evlekht evlekht changed the title [PVM, Dependencies] AddProposalTx, AddVoteTx, FinishProposalsTx [PVM, DAC] Txs and proposals Nov 15, 2023
services/indexes/pvm/writer.go Outdated Show resolved Hide resolved
services/indexes/pvm/writer.go Show resolved Hide resolved
services/indexes/params/params.go Outdated Show resolved Hide resolved
Copy link
Member

@knikos knikos left a comment

Choose a reason for hiding this comment

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

some last comments

knikos
knikos previously approved these changes Jan 17, 2024
@evlekht evlekht merged commit 4467dc4 into dev Jan 22, 2024
2 checks passed
@evlekht evlekht deleted the evlekht/dac branch January 22, 2024 09:21
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.

2 participants