-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add Token Extensions as a Governance Plugin Program #95
Conversation
…program-library into gib-bounty-Zpetb
@@ -197,7 +196,7 @@ async fn test_configure_registrar_with_invalid_spl_gov_program_id_error( | |||
.unwrap(); | |||
|
|||
// Assert | |||
assert_anchor_err(err, anchor_lang::error::ErrorCode::ConstraintOwner); | |||
assert_gateway_err(err, GatewayError::InvalidRealmForRegistrar); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this change but this test doesn't test what it says, It tests invalid Realm
account but not its spl-governance
program owner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reason this has changed because anchor refuses to build if we use the previous assertion/constraint
and I believe this is due to the registrar having the same name as the registrar account in here
we could either change the name of the registrar to registrar_account to be able to use the previous method and the anchor compiler does not complain.
programs/token-voter/Cargo.toml
Outdated
solana-program = "1.18.12" | ||
# spl-governance = { version = "4.0.0", features = ["no-entrypoint"] } | ||
# spl-transfer-hook-interface = { version = "0.6.3" } | ||
spl-governance = { git = "https://github.com/crypt0miester/solana-program-library.git", branch = "gib-bounty-jlFb5", default-features = false, features = ["no-entrypoint"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What changes are required in spl-governance
to support the plugin? Can you make a PR to SPL with the changes so we can reference a published version here please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do the changes and make PR to solana-program-library.
this was changed to use spl-governance in crates. code has been fixed to use it. since council_mint and community_mint does not have to be a token_2022 owned account.
@@ -0,0 +1,217 @@ | |||
/// A macro is exposed so that we can embed the program ID. | |||
#[macro_export] | |||
macro_rules! vote_weight_record { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check whether VoterWeightRecord
and MaxVoterWeightRecord
get exported in the program IDL?
As far as I can tell they are not but maybe I'm doing something wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they are not exported in the IDL as an account (only Registrar and Voter are there). but the discriminator is included in the instructions and the types as well.
Would you like me to make it a regular state account instead of a macro?
} | ||
|
||
/// Checks if the provided spl_token_program is spl token 2022 | ||
pub fn is_spl_token_2022(spl_token_program_id: &Pubkey) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think about any attack vectors atm but it would be safer to check for the token-2022
id
instead of implying it by not being the token
program
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is only used once to verify that it is token-2022 account and if it is we check if the mint has extensions. this is done to create the spl-token-2022 account in here
closed in favor of #98 |
This pull request was created by https://app.gib.work/i/IAesrPp7/token2022-support-as-a-governance-plugin in an attempt to solve a bounty. Payment for the bounty is immediately sent to the contributor after merge.
The following changes are for the addressed issue in #93:
Regards,
miester.