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] Admin proposals #282

Merged
merged 3 commits into from
Nov 14, 2023
Merged

[PVM, DAC] Admin proposals #282

merged 3 commits into from
Nov 14, 2023

Conversation

evlekht
Copy link
Member

@evlekht evlekht commented Nov 9, 2023

Why this should be merged

This PR does 2 things:

  • introduces feature "admin proposals"
  • forbids addressStateTx to edit consortium bit

Admin proposals are proposals that can be created only by allowed role (on proposal-type basis) and will be executed immediately after creation without any voting. So, they're more like admin actions than proposals.

How this works

Admin proposals

PR adds new proposal type that wraps other proposal types.

type AdminProposal struct {
	OptionIndex uint32 `serialize:"true"`
	Proposal    `serialize:"true"`
}

If proposal of this type is inside of addProposalTx, than tx will try to create admin proposal.

On execution node will check if wrapped proposal type actually allows be used as admin proposal, than it will check that proposer has address state role that allows him to create admin proposals of this type.

If all checks successful, node will create proposal state with already existing vote for specified option index and then will its id as finished proposal. So, on next block-build, node will create finishProposalsTx with this proposal.

AddressStateTx

If BerlinPhase is active, node will reject addressStateTx that tries to edit consortium bit, even if its signed by admin role.

This PR also moves address state definitions from txs to their own package, cause its now used from dac pkg as well and this is causing cycle deps.

How this was tested

Unit-tests, integration test

@evlekht evlekht force-pushed the evlekht/admin-proposals branch 2 times, most recently from 8c99fa2 to 300e77b Compare November 13, 2023 13:23
@evlekht evlekht marked this pull request as ready for review November 13, 2023 13:29
@knikos knikos self-requested a review November 13, 2023 13:59
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.

great job and very goot test coverage!!! just some comments related mostly to formatting issues.

only one thing to note: I would add a test that checks whether an Admin Proposal CanBeFinished() immediately after being created just to have that extra unit test.

genesis/camino_genesis.go Show resolved Hide resolved
vms/platformvm/camino_helpers_test.go Show resolved Hide resolved
vms/platformvm/camino_service.go Show resolved Hide resolved
vms/platformvm/state/camino_diff_test.go Show resolved Hide resolved
vms/platformvm/state/camino_state.go Show resolved Hide resolved
vms/platformvm/state/camino_test.go Show resolved Hide resolved
vms/platformvm/txs/builder/camino_builder.go Show resolved Hide resolved
@evlekht evlekht force-pushed the evlekht/admin-proposals branch from 300e77b to c3b0f60 Compare November 14, 2023 09:37
@evlekht evlekht force-pushed the evlekht/admin-proposals branch from c3b0f60 to f367182 Compare November 14, 2023 09:56
@evlekht evlekht merged commit a2e4e89 into dev Nov 14, 2023
5 checks passed
@evlekht evlekht deleted the evlekht/admin-proposals branch November 14, 2023 10:08
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