Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Module 0x1::governance_proposal

Define the GovernanceProposal that will be used as part of on-chain governance by AptosGovernance.

This is separate from the AptosGovernance module to avoid circular dependency between AptosGovernance and Stake.

Struct GovernanceProposal

struct GovernanceProposal has drop, store
Fields
dummy_field: bool

Function create_proposal

Create and return a GovernanceProposal resource. Can only be called by AptosGovernance

public(friend) fun create_proposal(): governance_proposal::GovernanceProposal
Implementation
public(friend) fun create_proposal(): GovernanceProposal {
    GovernanceProposal {}
}

Function create_empty_proposal

Useful for AptosGovernance to create an empty proposal as proof.

public(friend) fun create_empty_proposal(): governance_proposal::GovernanceProposal
Implementation
public(friend) fun create_empty_proposal(): GovernanceProposal {
    create_proposal()
}

Specification

Function create_proposal

public(friend) fun create_proposal(): governance_proposal::GovernanceProposal

High-level Requirements

No.RequirementCriticalityImplementationEnforcement
1 Creating a proposal should never abort but should always return a governance proposal resource. Medium Both create_proposal and create_empty_proposal functions return a GovernanceProposal resource. Enforced via create_proposal and create_empty_proposal.
2 The governance proposal module should only be accessible to the aptos governance. Medium Both create_proposal and create_empty_proposal functions are only available to the friend module aptos_framework::aptos_governance. Enforced via friend module relationship.

Module-level Specification

aborts_if false;
// This enforces high-level requirement 1:
ensures result == GovernanceProposal {};

Function create_empty_proposal

public(friend) fun create_empty_proposal(): governance_proposal::GovernanceProposal
aborts_if false;
// This enforces high-level requirement 1:
ensures result == GovernanceProposal {};