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

token 2022: add InitializeGroup instruction from SPL Token Group interface #5601

Conversation

buffalojoec
Copy link
Contributor

@buffalojoec buffalojoec commented Oct 18, 2023

This PR adds the InitializeGroup instruction to Token2022 - from the SPL Token Group interface.

@buffalojoec buffalojoec force-pushed the 10-18-token_2022_add_InitializeGroup_instruction_from_SPL_Token_Group_interface branch from 5b340e5 to dbd9ef8 Compare October 18, 2023 13:48
@buffalojoec buffalojoec force-pushed the 10-18-token_2022_make_IncorrectMintAuthority_a_TokenError_ branch from 82f3418 to 31ee52e Compare October 18, 2023 13:50
@buffalojoec buffalojoec force-pushed the 10-18-token_2022_add_InitializeGroup_instruction_from_SPL_Token_Group_interface branch from dbd9ef8 to 834d4a3 Compare October 18, 2023 13:50
@buffalojoec buffalojoec changed the base branch from 10-18-token_2022_make_IncorrectMintAuthority_a_TokenError_ to 10-20-token_2022_add_GroupPointer_extension October 20, 2023 10:54
@buffalojoec buffalojoec force-pushed the 10-18-token_2022_add_InitializeGroup_instruction_from_SPL_Token_Group_interface branch from 834d4a3 to 92b33dc Compare October 20, 2023 10:54
@buffalojoec buffalojoec force-pushed the 10-20-token_2022_add_GroupPointer_extension branch from 2c5bf6c to c4a0ffa Compare October 20, 2023 10:56
@buffalojoec buffalojoec force-pushed the 10-18-token_2022_add_InitializeGroup_instruction_from_SPL_Token_Group_interface branch from 92b33dc to 35b6a07 Compare October 20, 2023 10:56
@buffalojoec buffalojoec force-pushed the 10-20-token_2022_add_GroupPointer_extension branch from c4a0ffa to 1b7a918 Compare October 20, 2023 11:33
@buffalojoec buffalojoec force-pushed the 10-18-token_2022_add_InitializeGroup_instruction_from_SPL_Token_Group_interface branch 2 times, most recently from d942fb4 to ecba134 Compare October 20, 2023 11:38
@buffalojoec buffalojoec marked this pull request as ready for review October 20, 2023 11:38
@buffalojoec buffalojoec force-pushed the 10-20-token_2022_add_GroupPointer_extension branch 2 times, most recently from c5d4211 to 260e7b2 Compare October 21, 2023 07:19
@buffalojoec buffalojoec force-pushed the 10-18-token_2022_add_InitializeGroup_instruction_from_SPL_Token_Group_interface branch 3 times, most recently from 3860a11 to 8080c30 Compare October 21, 2023 14:29
@buffalojoec buffalojoec force-pushed the 10-18-token_2022_add_InitializeGroup_instruction_from_SPL_Token_Group_interface branch from 8080c30 to 17677bf Compare October 21, 2023 14:55
Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great for the most part! Just the one bit about realloc, wondering if we can tighten that up some more

token/program-2022/src/extension/token_group/processor.rs Outdated Show resolved Hide resolved
token/program-2022/src/extension/mod.rs Show resolved Hide resolved
token/program-2022-test/tests/token_group_initialize.rs Outdated Show resolved Hide resolved
@buffalojoec buffalojoec changed the base branch from master to 10-26-token_2022_add_alloc_and_serialize_for_fixed-len_extensions October 26, 2023 14:25
@buffalojoec buffalojoec force-pushed the 10-18-token_2022_add_InitializeGroup_instruction_from_SPL_Token_Group_interface branch from aa4c6d4 to 01f924d Compare October 26, 2023 14:25
@buffalojoec buffalojoec force-pushed the 10-26-token_2022_add_alloc_and_serialize_for_fixed-len_extensions branch from 3ee9e63 to 6f83fe0 Compare October 26, 2023 14:32
@buffalojoec buffalojoec force-pushed the 10-18-token_2022_add_InitializeGroup_instruction_from_SPL_Token_Group_interface branch from 01f924d to ff6ce5b Compare October 26, 2023 14:32
@buffalojoec buffalojoec force-pushed the 10-26-token_2022_add_alloc_and_serialize_for_fixed-len_extensions branch from 6f83fe0 to 878e601 Compare October 26, 2023 15:02
@buffalojoec buffalojoec force-pushed the 10-18-token_2022_add_InitializeGroup_instruction_from_SPL_Token_Group_interface branch from ff6ce5b to 837a1a0 Compare October 26, 2023 15:02
@buffalojoec buffalojoec force-pushed the 10-26-token_2022_add_alloc_and_serialize_for_fixed-len_extensions branch from 878e601 to a29209e Compare October 26, 2023 15:23
@buffalojoec buffalojoec force-pushed the 10-18-token_2022_add_InitializeGroup_instruction_from_SPL_Token_Group_interface branch from 837a1a0 to b31b5d0 Compare October 26, 2023 15:23
@buffalojoec buffalojoec force-pushed the 10-26-token_2022_add_alloc_and_serialize_for_fixed-len_extensions branch from 318e54b to 0509e06 Compare November 6, 2023 20:57
@buffalojoec buffalojoec force-pushed the 10-18-token_2022_add_InitializeGroup_instruction_from_SPL_Token_Group_interface branch from b31b5d0 to 629e2c2 Compare November 6, 2023 20:57
Base automatically changed from 10-26-token_2022_add_alloc_and_serialize_for_fixed-len_extensions to master November 8, 2023 08:57
@buffalojoec buffalojoec force-pushed the 10-18-token_2022_add_InitializeGroup_instruction_from_SPL_Token_Group_interface branch from 629e2c2 to e7fb59c Compare November 8, 2023 08:59
@buffalojoec buffalojoec force-pushed the 10-18-token_2022_add_InitializeGroup_instruction_from_SPL_Token_Group_interface branch from e7fb59c to 3a0de2e Compare November 9, 2023 09:13
joncinque
joncinque previously approved these changes Nov 9, 2023
Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Let's get the groups going

group

}

/// Initialize token-group on a mint
#[allow(clippy::too_many_arguments)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

micro-nit: I think clippy allows up to 7 args, so this shouldn't be needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What the 🤨
I think I had another arg in here or something. Changed!

if mint_state.get_extension::<V>().is_ok() {
Ok(0)
} else {
let new_account_len = mint_state.try_get_new_account_len::<V>()?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very neat 😎

@mergify mergify bot dismissed joncinque’s stale review November 9, 2023 12:19

Pull request has been modified.

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