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

Governance: v3.1 #3915

Merged
merged 9 commits into from
Dec 15, 2022
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions governance/addin-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spl-governance-addin-api"
version = "0.1.2"
version = "0.1.3"
description = "Solana Program Library Governance Addin Api"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana-program-library"
Expand All @@ -9,6 +9,6 @@ edition = "2021"

[dependencies]
borsh = "0.9.1"
spl-governance-tools= { version = "0.1.2", path ="../tools"}
spl-governance-tools= { version = "0.1.3", path ="../tools"}
solana-program = "1.14.10"

8 changes: 4 additions & 4 deletions governance/addin-mock/program/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spl-governance-addin-mock"
version = "0.1.2"
version = "0.1.3"
description = "Solana Program Library Governance Voter Weight Addin Program"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana-program-library"
Expand All @@ -21,8 +21,8 @@ serde = "1.0.127"
serde_derive = "1.0.103"
solana-program = "1.14.10"
spl-token = { version = "3.5", path = "../../../token/program", features = [ "no-entrypoint" ] }
spl-governance-addin-api= { version = "0.1.2", path ="../../addin-api"}
spl-governance-tools= { version = "0.1.2", path ="../../tools"}
spl-governance-addin-api= { version = "0.1.3", path ="../../addin-api"}
spl-governance-tools= { version = "0.1.3", path ="../../tools"}
thiserror = "1.0"


Expand All @@ -32,7 +32,7 @@ base64 = "0.13"
proptest = "1.0"
solana-program-test = "1.14.10"
solana-sdk = "1.14.10"
spl-governance-test-sdk = { version = "0.1.2", path ="../../test-sdk"}
spl-governance-test-sdk = { version = "0.1.3", path ="../../test-sdk"}


[lib]
Expand Down
12 changes: 6 additions & 6 deletions governance/chat/program/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spl-governance-chat"
version = "0.2.6"
version = "0.2.7"
description = "Solana Program Library Governance Chat Program"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana-program-library"
Expand All @@ -21,9 +21,9 @@ serde = "1.0.127"
serde_derive = "1.0.103"
solana-program = "1.14.10"
spl-token = { version = "3.5", path = "../../../token/program", features = [ "no-entrypoint" ] }
spl-governance= { version = "3.0.0", path ="../../program", features = [ "no-entrypoint" ]}
spl-governance-tools= { version = "0.1.2", path ="../../tools"}
spl-governance-addin-api= { version = "0.1.2", path ="../../addin-api"}
spl-governance= { version = "3.1.0", path ="../../program", features = [ "no-entrypoint" ]}
spl-governance-tools= { version = "0.1.3", path ="../../tools"}
spl-governance-addin-api= { version = "0.1.3", path ="../../addin-api"}
thiserror = "1.0"


Expand All @@ -33,8 +33,8 @@ base64 = "0.13"
proptest = "1.0"
solana-program-test = "1.14.10"
solana-sdk = "1.14.10"
spl-governance-test-sdk = { version = "0.1.2", path ="../../test-sdk"}
spl-governance-addin-mock = { version = "0.1.2", path ="../../addin-mock/program"}
spl-governance-test-sdk = { version = "0.1.3", path ="../../test-sdk"}
spl-governance-addin-mock = { version = "0.1.3", path ="../../addin-mock/program"}


[lib]
Expand Down
13 changes: 8 additions & 5 deletions governance/chat/program/tests/program_test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ use spl_governance::{
},
state::{
enums::{MintMaxVoterWeightSource, VoteThreshold},
governance::{get_governance_address, GovernanceConfig},
governance::{
get_governance_address, GovernanceConfig, DEFAULT_DEPOSIT_EXEMPT_PROPOSAL_COUNT,
},
proposal::{get_proposal_address, VoteType},
realm::{get_realm_address, GoverningTokenConfigAccountArgs},
realm_config::GoverningTokenType,
Expand Down Expand Up @@ -197,7 +199,7 @@ impl GovernanceChatProgramTest {
council_vote_tipping: spl_governance::state::enums::VoteTipping::Strict,
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(55),
voting_cool_off_time: 1,
reserved: 0,
deposit_exempt_proposal_count: DEFAULT_DEPOSIT_EXEMPT_PROPOSAL_COUNT,
};

let token_owner_record_address = get_token_owner_record_address(
Expand Down Expand Up @@ -259,8 +261,9 @@ impl GovernanceChatProgramTest {
let proposal_name = "Proposal #1".to_string();
let description_link = "Proposal Description".to_string();
let options = vec!["Yes".to_string()];
let proposal_index: u32 = 0;

let use_deny_option = true;
let proposal_seed = Pubkey::new_unique();

let create_proposal_ix = create_proposal(
&self.governance_program_id,
Expand All @@ -276,7 +279,7 @@ impl GovernanceChatProgramTest {
VoteType::SingleChoice,
options,
use_deny_option,
proposal_index,
&proposal_seed,
);

self.bench
Expand All @@ -288,7 +291,7 @@ impl GovernanceChatProgramTest {
&self.governance_program_id,
&governance_address,
&governing_token_mint_keypair.pubkey(),
&proposal_index.to_le_bytes(),
&proposal_seed,
);

ProposalCookie {
Expand Down
10 changes: 5 additions & 5 deletions governance/program/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spl-governance"
version = "3.0.0"
version = "3.1.0"
description = "Solana Program Library Governance Program"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana-program-library"
Expand All @@ -21,8 +21,8 @@ serde = "1.0.130"
serde_derive = "1.0.103"
solana-program = "1.14.10"
spl-token = { version = "3.5", path = "../../token/program", features = [ "no-entrypoint" ] }
spl-governance-tools= { version = "0.1.2", path ="../tools"}
spl-governance-addin-api= { version = "0.1.2", path ="../addin-api"}
spl-governance-tools= { version = "0.1.3", path ="../tools"}
spl-governance-addin-api= { version = "0.1.3", path ="../addin-api"}
thiserror = "1.0"

[dev-dependencies]
Expand All @@ -31,8 +31,8 @@ base64 = "0.13"
proptest = "1.0"
solana-program-test = "1.14.10"
solana-sdk = "1.14.10"
spl-governance-test-sdk = { version = "0.1.2", path ="../test-sdk"}
spl-governance-addin-mock = { version = "0.1.2", path ="../addin-mock/program"}
spl-governance-test-sdk = { version = "0.1.3", path ="../test-sdk"}
spl-governance-addin-mock = { version = "0.1.3", path ="../addin-mock/program"}


[lib]
Expand Down
26 changes: 23 additions & 3 deletions governance/program/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ pub enum GovernanceError {
#[error("Given VoteWeightSource is not supported")]
VoteWeightSourceNotSupported, // 559

/// GoverningTokenMint not allowed to vote
#[error("GoverningTokenMint not allowed to vote")]
GoverningTokenMintNotAllowedToVote, // 560
/// Legacy1
#[error("Legacy1")]
Legacy1, // 560

/// Governance PDA must sign
#[error("Governance PDA must sign")]
Expand Down Expand Up @@ -442,6 +442,26 @@ pub enum GovernanceError {
/// Vote not allowed in cool off time
#[error("Vote not allowed in cool off time")]
VoteNotAllowedInCoolOffTime, // 606

/// Cannot refund ProposalDeposit
#[error("Cannot refund ProposalDeposit")]
CannotRefundProposalDeposit, // 607

///Invalid Proposal for ProposalDeposit
#[error("Invalid Proposal for ProposalDeposit")]
InvalidProposalForProposalDeposit, // 608

/// Invalid deposit_exempt_proposal_count
#[error("Invalid deposit_exempt_proposal_count")]
InvalidDepositExemptProposalCount, // 609

/// GoverningTokenMint not allowed to vote
#[error("GoverningTokenMint not allowed to vote")]
GoverningTokenMintNotAllowedToVote, // 610

///Invalid deposit Payer for ProposalDeposit
#[error("Invalid deposit Payer for ProposalDeposit")]
InvalidDepositPayerForProposalDeposit, // 611
}

impl PrintProgramError for GovernanceError {
Expand Down
Loading