Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 2c38c74

Browse files
committed
fix: update addin account discriminators to Anchor compatible
1 parent 8322b8b commit 2c38c74

File tree

7 files changed

+20
-16
lines changed

7 files changed

+20
-16
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

governance/addin-api/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "spl-governance-addin-api"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
description = "Solana Program Library Governance Addin Api"
55
authors = ["Solana Maintainers <[email protected]>"]
66
repository = "https://github.com/solana-labs/solana-program-library"

governance/addin-api/src/max_voter_weight.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ impl AccountMaxSize for MaxVoterWeightRecord {}
4040

4141
impl MaxVoterWeightRecord {
4242
/// sha256("account:MaxVoterWeightRecord")[..8]
43-
pub const ACCOUNT_DISCRIMINATOR: [u8; 8] = *b"9d5ff297";
43+
pub const ACCOUNT_DISCRIMINATOR: [u8; 8] = [157, 95, 242, 151, 16, 98, 26, 118];
4444
}
4545

4646
impl IsInitialized for MaxVoterWeightRecord {
4747
fn is_initialized(&self) -> bool {
4848
self.account_discriminator == MaxVoterWeightRecord::ACCOUNT_DISCRIMINATOR
49+
// Check for legacy discriminator which is not compatible with Anchor but is used by older plugins
50+
|| self.account_discriminator ==*b"9d5ff297"
4951
}
5052
}

governance/addin-api/src/voter_weight.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@ pub struct VoterWeightRecord {
7373

7474
impl VoterWeightRecord {
7575
/// sha256("account:VoterWeightRecord")[..8]
76-
pub const ACCOUNT_DISCRIMINATOR: [u8; 8] = *b"2ef99b4b";
76+
pub const ACCOUNT_DISCRIMINATOR: [u8; 8] = [46, 249, 155, 75, 153, 248, 116, 9];
7777
}
7878

7979
impl AccountMaxSize for VoterWeightRecord {}
8080

8181
impl IsInitialized for VoterWeightRecord {
8282
fn is_initialized(&self) -> bool {
8383
self.account_discriminator == VoterWeightRecord::ACCOUNT_DISCRIMINATOR
84+
// Check for legacy discriminator which is not compatible with Anchor but is used by older plugins
85+
|| self.account_discriminator == *b"2ef99b4b"
8486
}
8587
}

governance/addin-mock/program/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "spl-governance-addin-mock"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
description = "Solana Program Library Governance Voter Weight Addin Program"
55
authors = ["Solana Maintainers <[email protected]>"]
66
repository = "https://github.com/solana-labs/solana-program-library"
@@ -21,7 +21,7 @@ serde = "1.0.127"
2121
serde_derive = "1.0.103"
2222
solana-program = "1.9.9"
2323
spl-token = { version = "3.3", path = "../../../token/program", features = [ "no-entrypoint" ] }
24-
spl-governance-addin-api= { version = "0.1.1", path ="../../addin-api"}
24+
spl-governance-addin-api= { version = "0.1.2", path ="../../addin-api"}
2525
spl-governance-tools= { version = "0.1.2", path ="../../tools"}
2626
thiserror = "1.0"
2727

governance/chat/program/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "spl-governance-chat"
3-
version = "0.2.4"
3+
version = "0.2.5"
44
description = "Solana Program Library Governance Chat Program"
55
authors = ["Solana Maintainers <[email protected]>"]
66
repository = "https://github.com/solana-labs/solana-program-library"
@@ -21,9 +21,9 @@ serde = "1.0.127"
2121
serde_derive = "1.0.103"
2222
solana-program = "1.9.9"
2323
spl-token = { version = "3.3", path = "../../../token/program", features = [ "no-entrypoint" ] }
24-
spl-governance= { version = "2.2.3", path ="../../program", features = [ "no-entrypoint" ]}
24+
spl-governance= { version = "2.2.4", path ="../../program", features = [ "no-entrypoint" ]}
2525
spl-governance-tools= { version = "0.1.2", path ="../../tools"}
26-
spl-governance-addin-api= { version = "0.1.1", path ="../../addin-api"}
26+
spl-governance-addin-api= { version = "0.1.2", path ="../../addin-api"}
2727
thiserror = "1.0"
2828

2929

@@ -34,7 +34,7 @@ proptest = "1.0"
3434
solana-program-test = "1.9.9"
3535
solana-sdk = "1.9.9"
3636
spl-governance-test-sdk = { version = "0.1.2", path ="../../test-sdk"}
37-
spl-governance-addin-mock = { version = "0.1.1", path ="../../addin-mock/program"}
37+
spl-governance-addin-mock = { version = "0.1.2", path ="../../addin-mock/program"}
3838

3939

4040
[lib]

governance/program/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "spl-governance"
3-
version = "2.2.3"
3+
version = "2.2.4"
44
description = "Solana Program Library Governance Program"
55
authors = ["Solana Maintainers <[email protected]>"]
66
repository = "https://github.com/solana-labs/solana-program-library"
@@ -22,7 +22,7 @@ serde_derive = "1.0.103"
2222
solana-program = "1.9.9"
2323
spl-token = { version = "3.3", path = "../../token/program", features = [ "no-entrypoint" ] }
2424
spl-governance-tools= { version = "0.1.2", path ="../tools"}
25-
spl-governance-addin-api= { version = "0.1.1", path ="../addin-api"}
25+
spl-governance-addin-api= { version = "0.1.2", path ="../addin-api"}
2626
thiserror = "1.0"
2727

2828
[dev-dependencies]
@@ -32,7 +32,7 @@ proptest = "1.0"
3232
solana-program-test = "1.9.9"
3333
solana-sdk = "1.9.9"
3434
spl-governance-test-sdk = { version = "0.1.2", path ="../test-sdk"}
35-
spl-governance-addin-mock = { version = "0.1.1", path ="../addin-mock/program"}
35+
spl-governance-addin-mock = { version = "0.1.2", path ="../addin-mock/program"}
3636

3737

3838
[lib]

0 commit comments

Comments
 (0)