From 8cadd69e0c9f887442ba4881e713a364d74cedd7 Mon Sep 17 00:00:00 2001 From: Jackson Doherty Date: Sat, 10 Aug 2024 09:07:04 -0400 Subject: [PATCH 1/8] Change max size to u64 in interface --- token-group/interface/README.md | 8 +++---- token-group/interface/src/instruction.rs | 10 ++++---- token-group/interface/src/state.rs | 30 ++++++++++++------------ 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/token-group/interface/README.md b/token-group/interface/README.md index e221d7f7d63..04925742cbc 100644 --- a/token-group/interface/README.md +++ b/token-group/interface/README.md @@ -95,7 +95,7 @@ For a group: ```rust type OptionalNonZeroPubkey = Pubkey; // if all zeroes, interpreted as `None` -type PodU32 = [u8; 4]; +type PodU64 = [u8; 8]; type Pubkey = [u8; 32]; /// Type discriminant: [214, 15, 63, 132, 49, 119, 209, 40] @@ -107,9 +107,9 @@ pub struct TokenGroup { /// belongs to a particular mint pub mint: Pubkey, /// The current number of group members - pub size: PodU32, + pub size: PodU64, /// The maximum number of group members - pub max_size: PodU32, + pub max_size: PodU64, } ``` @@ -125,7 +125,7 @@ pub struct TokenGroupMember { /// The pubkey of the `TokenGroup` pub group: Pubkey, /// The member number - pub member_number: PodU32, + pub member_number: PodU64, } ``` diff --git a/token-group/interface/src/instruction.rs b/token-group/interface/src/instruction.rs index 67536d896bd..2ba4306683b 100644 --- a/token-group/interface/src/instruction.rs +++ b/token-group/interface/src/instruction.rs @@ -11,7 +11,7 @@ use { spl_pod::{ bytemuck::{pod_bytes_of, pod_from_bytes}, optional_keys::OptionalNonZeroPubkey, - primitives::PodU32, + primitives::PodU64, }, }; @@ -23,7 +23,7 @@ pub struct InitializeGroup { /// Update authority for the group pub update_authority: OptionalNonZeroPubkey, /// The maximum number of group members - pub max_size: PodU32, + pub max_size: PodU64, } /// Instruction data for updating the max size of a `Group` @@ -32,7 +32,7 @@ pub struct InitializeGroup { #[discriminator_hash_input("spl_token_group_interface:update_group_max_size")] pub struct UpdateGroupMaxSize { /// New max size for the group - pub max_size: PodU32, + pub max_size: PodU64, } /// Instruction data for updating the authority of a `Group` @@ -155,7 +155,7 @@ pub fn initialize_group( mint: &Pubkey, mint_authority: &Pubkey, update_authority: Option, - max_size: u32, + max_size: u64, ) -> Instruction { let update_authority = OptionalNonZeroPubkey::try_from(update_authority) .expect("Failed to deserialize `Option`"); @@ -180,7 +180,7 @@ pub fn update_group_max_size( program_id: &Pubkey, group: &Pubkey, update_authority: &Pubkey, - max_size: u32, + max_size: u64, ) -> Instruction { let data = TokenGroupInstruction::UpdateGroupMaxSize(UpdateGroupMaxSize { max_size: max_size.into(), diff --git a/token-group/interface/src/state.rs b/token-group/interface/src/state.rs index 9f73ecc442b..0766f6bad6e 100644 --- a/token-group/interface/src/state.rs +++ b/token-group/interface/src/state.rs @@ -5,7 +5,7 @@ use { bytemuck::{Pod, Zeroable}, solana_program::{program_error::ProgramError, pubkey::Pubkey}, spl_discriminator::SplDiscriminate, - spl_pod::{error::PodSliceError, optional_keys::OptionalNonZeroPubkey, primitives::PodU32}, + spl_pod::{error::PodSliceError, optional_keys::OptionalNonZeroPubkey, primitives::PodU64}, }; /// Data struct for a `TokenGroup` @@ -19,26 +19,26 @@ pub struct TokenGroup { /// belongs to a particular mint pub mint: Pubkey, /// The current number of group members - pub size: PodU32, + pub size: PodU64, /// The maximum number of group members - pub max_size: PodU32, + pub max_size: PodU64, } impl TokenGroup { /// Creates a new `TokenGroup` state - pub fn new(mint: &Pubkey, update_authority: OptionalNonZeroPubkey, max_size: u32) -> Self { + pub fn new(mint: &Pubkey, update_authority: OptionalNonZeroPubkey, max_size: u64) -> Self { Self { mint: *mint, update_authority, - size: PodU32::default(), // [0, 0, 0, 0] + size: PodU64::default(), // [0, 0, 0, 0, 0, 0, 0, 0] max_size: max_size.into(), } } /// Updates the max size for a group - pub fn update_max_size(&mut self, new_max_size: u32) -> Result<(), ProgramError> { + pub fn update_max_size(&mut self, new_max_size: u64) -> Result<(), ProgramError> { // The new max size cannot be less than the current size - if new_max_size < u32::from(self.size) { + if new_max_size < u64::from(self.size) { return Err(TokenGroupError::SizeExceedsNewMaxSize.into()); } self.max_size = new_max_size.into(); @@ -46,12 +46,12 @@ impl TokenGroup { } /// Increment the size for a group, returning the new size - pub fn increment_size(&mut self) -> Result { + pub fn increment_size(&mut self) -> Result { // The new size cannot be greater than the max size - let new_size = u32::from(self.size) + let new_size = u64::from(self.size) .checked_add(1) .ok_or::(PodSliceError::CalculationFailure.into())?; - if new_size > u32::from(self.max_size) { + if new_size > u64::from(self.max_size) { return Err(TokenGroupError::SizeExceedsMaxSize.into()); } self.size = new_size.into(); @@ -70,11 +70,11 @@ pub struct TokenGroupMember { /// The pubkey of the `TokenGroup` pub group: Pubkey, /// The member number - pub member_number: PodU32, + pub member_number: PodU64, } impl TokenGroupMember { /// Creates a new `TokenGroupMember` state - pub fn new(mint: &Pubkey, group: &Pubkey, member_number: u32) -> Self { + pub fn new(mint: &Pubkey, group: &Pubkey, member_number: u64) -> Self { Self { mint: *mint, group: *group, @@ -156,7 +156,7 @@ mod tests { let new_max_size = 30; group.update_max_size(new_max_size).unwrap(); - assert_eq!(u32::from(group.max_size), new_max_size); + assert_eq!(u64::from(group.max_size), new_max_size); // Change the current size to 30 group.size = 30.into(); @@ -170,7 +170,7 @@ mod tests { let new_max_size = 30; group.update_max_size(new_max_size).unwrap(); - assert_eq!(u32::from(group.max_size), new_max_size); + assert_eq!(u64::from(group.max_size), new_max_size); } #[test] @@ -183,7 +183,7 @@ mod tests { }; group.increment_size().unwrap(); - assert_eq!(u32::from(group.size), 1); + assert_eq!(u64::from(group.size), 1); // Try to increase the current size to 2, which is greater than the max size assert_eq!( From 2857eac830feb224b97304799b664a18aafc8094 Mon Sep 17 00:00:00 2001 From: Jackson Doherty Date: Sat, 10 Aug 2024 09:20:48 -0400 Subject: [PATCH 2/8] Update interface example and token client --- token-group/example/tests/initialize_member.rs | 2 +- token/client/src/token.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/token-group/example/tests/initialize_member.rs b/token-group/example/tests/initialize_member.rs index 6a0589e81e7..c5f6ba97869 100644 --- a/token-group/example/tests/initialize_member.rs +++ b/token-group/example/tests/initialize_member.rs @@ -256,5 +256,5 @@ async fn test_initialize_group_member() { let fetched_meta = TlvStateBorrowed::unpack(&member_account.data).unwrap(); let fetched_group_member_state = fetched_meta.get_first_value::().unwrap(); assert_eq!(fetched_group_member_state.group, group.pubkey()); - assert_eq!(u32::from(fetched_group_member_state.member_number), 1); + assert_eq!(u64::from(fetched_group_member_state.member_number), 1); } diff --git a/token/client/src/token.rs b/token/client/src/token.rs index 824875b6d31..88f55205520 100644 --- a/token/client/src/token.rs +++ b/token/client/src/token.rs @@ -3505,7 +3505,7 @@ where &self, mint_authority: &Pubkey, update_authority: &Pubkey, - max_size: u32, + max_size: u64, signing_keypairs: &S, ) -> TokenResult { self.process_ixs( @@ -3547,7 +3547,7 @@ where payer: &Pubkey, mint_authority: &Pubkey, update_authority: &Pubkey, - max_size: u32, + max_size: u64, signing_keypairs: &S, ) -> TokenResult { let additional_lamports = self @@ -3576,7 +3576,7 @@ where pub async fn token_group_update_max_size( &self, update_authority: &Pubkey, - new_max_size: u32, + new_max_size: u64, signing_keypairs: &S, ) -> TokenResult { self.process_ixs( From 33690d0594c4bba4e45eef6aa67661b4142b4058 Mon Sep 17 00:00:00 2001 From: Jackson Doherty Date: Sat, 10 Aug 2024 09:34:46 -0400 Subject: [PATCH 3/8] Update token CLI --- token/cli/src/command.rs | 8 ++++---- token/cli/tests/command.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/token/cli/src/command.rs b/token/cli/src/command.rs index b4e971c4a9d..929f9c9b4e3 100644 --- a/token/cli/src/command.rs +++ b/token/cli/src/command.rs @@ -648,7 +648,7 @@ async fn command_initialize_group( token_pubkey: Pubkey, mint_authority: Pubkey, update_authority: Pubkey, - max_size: u32, + max_size: u64, bulk_signers: Vec>, ) -> CommandResult { let token = token_client_from_config(config, &token_pubkey, None)?; @@ -679,7 +679,7 @@ async fn command_update_group_max_size( config: &Config<'_>, token_pubkey: Pubkey, update_authority: Pubkey, - new_max_size: u32, + new_max_size: u64, bulk_signers: Vec>, ) -> CommandResult { let token = token_client_from_config(config, &token_pubkey, None)?; @@ -3637,7 +3637,7 @@ pub async fn process_command<'a>( let token_pubkey = pubkey_of_signer(arg_matches, "token", &mut wallet_manager) .unwrap() .unwrap(); - let max_size = value_t_or_exit!(arg_matches, "max_size", u32); + let max_size = value_t_or_exit!(arg_matches, "max_size", u64); let (mint_authority_signer, mint_authority) = config.signer_or_default(arg_matches, "mint_authority", &mut wallet_manager); let update_authority = @@ -3658,7 +3658,7 @@ pub async fn process_command<'a>( let token_pubkey = pubkey_of_signer(arg_matches, "token", &mut wallet_manager) .unwrap() .unwrap(); - let new_max_size = value_t_or_exit!(arg_matches, "new_max_size", u32); + let new_max_size = value_t_or_exit!(arg_matches, "new_max_size", u64); let (update_authority_signer, update_authority) = config.signer_or_default(arg_matches, "update_authority", &mut wallet_manager); let bulk_signers = vec![update_authority_signer]; diff --git a/token/cli/tests/command.rs b/token/cli/tests/command.rs index 2ebf12385d6..eba7f9d470e 100644 --- a/token/cli/tests/command.rs +++ b/token/cli/tests/command.rs @@ -4151,7 +4151,7 @@ async fn group(test_validator: &TestValidator, payer: &Keypair) { let account = config.rpc_client.get_account(&mint).await.unwrap(); let group_mint_state = StateWithExtensionsOwned::::unpack(account.data).unwrap(); let extension = group_mint_state.get_extension::().unwrap(); - assert_eq!(u32::from(extension.size), 1); + assert_eq!(u64::from(extension.size), 1); let account = config.rpc_client.get_account(&member_mint).await.unwrap(); let member_mint_state = StateWithExtensionsOwned::::unpack(account.data).unwrap(); @@ -4160,7 +4160,7 @@ async fn group(test_validator: &TestValidator, payer: &Keypair) { .unwrap(); assert_eq!(extension.group, mint); assert_eq!(extension.mint, member_mint); - assert_eq!(u32::from(extension.member_number), 1); + assert_eq!(u64::from(extension.member_number), 1); // update authority process_test_command( From 6c2a1b99192e502ec1f06f6d4cc0cb45d59a94fa Mon Sep 17 00:00:00 2001 From: Jackson Doherty Date: Sat, 10 Aug 2024 09:49:56 -0400 Subject: [PATCH 4/8] Update additional token2022 tests --- .../tests/token_group_update_max_size.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/token/program-2022-test/tests/token_group_update_max_size.rs b/token/program-2022-test/tests/token_group_update_max_size.rs index 9e8382fae20..fef4db7e35e 100644 --- a/token/program-2022-test/tests/token_group_update_max_size.rs +++ b/token/program-2022-test/tests/token_group_update_max_size.rs @@ -61,17 +61,17 @@ async fn setup(mint: Keypair, authority: &Pubkey) -> TestContext { #[test_case(50, 0, 300_000_000)] #[test_case(100_000, 100_000, 300_000_000)] #[test_case(100_000_000, 100_000_000, 300_000_000)] -#[test_case(0, 0, u32::MAX)] -#[test_case(200_000, 200_000, u32::MAX)] -#[test_case(300_000_000, 300_000_000, u32::MAX)] +#[test_case(0, 0, u64::MAX)] +#[test_case(200_000, 200_000, u64::MAX)] +#[test_case(300_000_000, 300_000_000, u64::MAX)] // Attempts to set lower than size #[test_case(5, 5, 4)] #[test_case(200_000, 200_000, 50)] #[test_case(200_000, 200_000, 100_000)] #[test_case(300_000_000, 300_000_000, 50)] -#[test_case(u32::MAX, u32::MAX, 0)] +#[test_case(u64::MAX, u64::MAX, 0)] #[tokio::test] -async fn test_update_group_max_size(max_size: u32, size: u32, new_max_size: u32) { +async fn test_update_group_max_size(max_size: u64, size: u64, new_max_size: u64) { let authority = Keypair::new(); let mint_keypair = Keypair::new(); let mut test_context = setup(mint_keypair.insecure_clone(), &authority.pubkey()).await; From ed9e01437af27b0c98ae3d50d310918ef73f8f6b Mon Sep 17 00:00:00 2001 From: Jackson Doherty Date: Sun, 11 Aug 2024 10:44:25 -0400 Subject: [PATCH 5/8] Update collection example --- token-collection/program/tests/setup.rs | 2 +- token-collection/program/tests/token_collection.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/token-collection/program/tests/setup.rs b/token-collection/program/tests/setup.rs index 709f6f92943..363fc5c1b5a 100644 --- a/token-collection/program/tests/setup.rs +++ b/token-collection/program/tests/setup.rs @@ -89,7 +89,7 @@ pub async fn setup_group( mint: &Keypair, mint_authority: &Keypair, update_authority: Option, - max_size: u32, + max_size: u64, rent_lamports: u64, space: usize, ) { diff --git a/token-collection/program/tests/token_collection.rs b/token-collection/program/tests/token_collection.rs index aeff8994ef8..79505163a43 100644 --- a/token-collection/program/tests/token_collection.rs +++ b/token-collection/program/tests/token_collection.rs @@ -325,7 +325,7 @@ async fn test_token_collection() { .data; let state = TlvStateBorrowed::unpack(&buffer).unwrap(); let collection = state.get_first_value::().unwrap(); - assert_eq!(u32::from(collection.size), 3); + assert_eq!(u64::from(collection.size), 3); // The "Snakes" collection should have 2 members let buffer = context @@ -337,7 +337,7 @@ async fn test_token_collection() { .data; let state = TlvStateBorrowed::unpack(&buffer).unwrap(); let collection = state.get_first_value::().unwrap(); - assert_eq!(u32::from(collection.size), 2); + assert_eq!(u64::from(collection.size), 2); // The "Python" should be a member of 2 collections let buffer = context From d5b66526a4181f1d4bc5b4afaef91ea714d143dc Mon Sep 17 00:00:00 2001 From: Jackson Doherty Date: Sun, 11 Aug 2024 11:17:11 -0400 Subject: [PATCH 6/8] Update JS client to bigint --- token-group/js/src/instruction.ts | 10 +++++----- token-group/js/src/state/tokenGroup.ts | 10 +++++----- token-group/js/src/state/tokenGroupMember.ts | 6 +++--- token-group/js/test/instruction.test.ts | 8 ++++---- token-group/js/test/state.test.ts | 10 +++++----- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/token-group/js/src/instruction.ts b/token-group/js/src/instruction.ts index ff82c9f953a..6d14cbb4b95 100644 --- a/token-group/js/src/instruction.ts +++ b/token-group/js/src/instruction.ts @@ -5,7 +5,7 @@ import { getBytesEncoder, getStructEncoder, getTupleEncoder, - getU32Encoder, + getU64Encoder, transformEncoder, } from '@solana/codecs'; import { splDiscriminate } from '@solana/spl-type-length-value'; @@ -28,7 +28,7 @@ export interface InitializeGroupInstruction { mint: PublicKey; mintAuthority: PublicKey; updateAuthority: PublicKey | null; - maxSize: number; + maxSize: bigint; } export function createInitializeGroupInstruction(args: InitializeGroupInstruction): TransactionInstruction { @@ -46,7 +46,7 @@ export function createInitializeGroupInstruction(args: InitializeGroupInstructio splDiscriminate('spl_token_group_interface:initialize_token_group'), getStructEncoder([ ['updateAuthority', getPublicKeyEncoder()], - ['maxSize', getU32Encoder()], + ['maxSize', getU64Encoder()], ]), ).encode({ updateAuthority: updateAuthority ?? SystemProgram.programId, maxSize }), ), @@ -57,7 +57,7 @@ export interface UpdateGroupMaxSize { programId: PublicKey; group: PublicKey; updateAuthority: PublicKey; - maxSize: number; + maxSize: bigint; } export function createUpdateGroupMaxSizeInstruction(args: UpdateGroupMaxSize): TransactionInstruction { @@ -71,7 +71,7 @@ export function createUpdateGroupMaxSizeInstruction(args: UpdateGroupMaxSize): T data: Buffer.from( getInstructionEncoder( splDiscriminate('spl_token_group_interface:update_group_max_size'), - getStructEncoder([['maxSize', getU32Encoder()]]), + getStructEncoder([['maxSize', getU64Encoder()]]), ).encode({ maxSize }), ), }); diff --git a/token-group/js/src/state/tokenGroup.ts b/token-group/js/src/state/tokenGroup.ts index ecc51254268..c0895e28507 100644 --- a/token-group/js/src/state/tokenGroup.ts +++ b/token-group/js/src/state/tokenGroup.ts @@ -1,12 +1,12 @@ import { PublicKey } from '@solana/web3.js'; import type { ReadonlyUint8Array } from '@solana/codecs'; -import { fixCodecSize, getBytesCodec, getStructCodec, getU32Codec } from '@solana/codecs'; +import { fixCodecSize, getBytesCodec, getStructCodec, getU64Codec } from '@solana/codecs'; const tokenGroupCodec = getStructCodec([ ['updateAuthority', fixCodecSize(getBytesCodec(), 32)], ['mint', fixCodecSize(getBytesCodec(), 32)], - ['size', getU32Codec()], - ['maxSize', getU32Codec()], + ['size', getU64Codec()], + ['maxSize', getU64Codec()], ]); export const TOKEN_GROUP_SIZE = tokenGroupCodec.fixedSize; @@ -17,9 +17,9 @@ export interface TokenGroup { /** The associated mint, used to counter spoofing to be sure that group belongs to a particular mint */ mint: PublicKey; /** The current number of group members */ - size: number; + size: bigint; /** The maximum number of group members */ - maxSize: number; + maxSize: bigint; } // Checks if all elements in the array are 0 diff --git a/token-group/js/src/state/tokenGroupMember.ts b/token-group/js/src/state/tokenGroupMember.ts index 8d49a0316a7..c952c4faaa1 100644 --- a/token-group/js/src/state/tokenGroupMember.ts +++ b/token-group/js/src/state/tokenGroupMember.ts @@ -1,11 +1,11 @@ import { PublicKey } from '@solana/web3.js'; import type { ReadonlyUint8Array } from '@solana/codecs'; -import { fixCodecSize, getBytesCodec, getStructCodec, getU32Codec } from '@solana/codecs'; +import { fixCodecSize, getBytesCodec, getStructCodec, getU64Codec } from '@solana/codecs'; const tokenGroupMemberCodec = getStructCodec([ ['mint', fixCodecSize(getBytesCodec(), 32)], ['group', fixCodecSize(getBytesCodec(), 32)], - ['memberNumber', getU32Codec()], + ['memberNumber', getU64Codec()], ]); export const TOKEN_GROUP_MEMBER_SIZE = tokenGroupMemberCodec.fixedSize; @@ -16,7 +16,7 @@ export interface TokenGroupMember { /** The pubkey of the `TokenGroup` */ group: PublicKey; /** The member number */ - memberNumber: number; + memberNumber: bigint; } // Pack TokenGroupMember into byte slab diff --git a/token-group/js/test/instruction.test.ts b/token-group/js/test/instruction.test.ts index ebf26e4d29e..ad8f405d406 100644 --- a/token-group/js/test/instruction.test.ts +++ b/token-group/js/test/instruction.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; import type { Decoder } from '@solana/codecs'; -import { fixDecoderSize, getBytesDecoder, getStructDecoder, getU32Decoder } from '@solana/codecs'; +import { fixDecoderSize, getBytesDecoder, getStructDecoder, getU64Decoder } from '@solana/codecs'; import { splDiscriminate } from '@solana/spl-type-length-value'; import { PublicKey, type TransactionInstruction } from '@solana/web3.js'; @@ -28,7 +28,7 @@ describe('Token Group Instructions', () => { const updateAuthority = new PublicKey('44444444444444444444444444444444444444444444'); const mint = new PublicKey('55555555555555555555555555555555555555555555'); const mintAuthority = new PublicKey('66666666666666666666666666666666666666666666'); - const maxSize = 100; + const maxSize = BigInt(100); it('Can create InitializeGroup Instruction', () => { checkPackUnpack( @@ -43,7 +43,7 @@ describe('Token Group Instructions', () => { splDiscriminate('spl_token_group_interface:initialize_token_group'), getStructDecoder([ ['updateAuthority', fixDecoderSize(getBytesDecoder(), 32)], - ['maxSize', getU32Decoder()], + ['maxSize', getU64Decoder()], ]), { updateAuthority: Uint8Array.from(updateAuthority.toBuffer()), maxSize }, ); @@ -58,7 +58,7 @@ describe('Token Group Instructions', () => { maxSize, }), splDiscriminate('spl_token_group_interface:update_group_max_size'), - getStructDecoder([['maxSize', getU32Decoder()]]), + getStructDecoder([['maxSize', getU64Decoder()]]), { maxSize }, ); }); diff --git a/token-group/js/test/state.test.ts b/token-group/js/test/state.test.ts index 36f874b5209..f071de87dc1 100644 --- a/token-group/js/test/state.test.ts +++ b/token-group/js/test/state.test.ts @@ -16,16 +16,16 @@ describe('Token Group State', () => { checkPackUnpack({ mint: new PublicKey('44444444444444444444444444444444444444444444'), updateAuthority: new PublicKey('55555555555555555555555555555555555555555555'), - size: 10, - maxSize: 20, + size: BigInt(10), + maxSize: BigInt(20), }); }); it('Can pack and unpack TokenGroup without updateAuthoritygroup', () => { checkPackUnpack({ mint: new PublicKey('44444444444444444444444444444444444444444444'), - size: 10, - maxSize: 20, + size: BigInt(10), + maxSize: BigInt(20), }); }); }); @@ -40,7 +40,7 @@ describe('Token Group State', () => { checkPackUnpack({ mint: new PublicKey('55555555555555555555555555555555555555555555'), group: new PublicKey('66666666666666666666666666666666666666666666'), - memberNumber: 8, + memberNumber: BigInt(8), }); }); }); From b6bc95db76e5d5c544b6d9a4682538cda9d1055a Mon Sep 17 00:00:00 2001 From: Jackson Doherty Date: Sun, 11 Aug 2024 11:41:36 -0400 Subject: [PATCH 7/8] Update e2e tests --- token/js/src/extensions/tokenGroup/actions.ts | 6 ++--- token/js/test/e2e-2022/tokenGroup.test.ts | 22 +++++++++---------- .../js/test/e2e-2022/tokenGroupMember.test.ts | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/token/js/src/extensions/tokenGroup/actions.ts b/token/js/src/extensions/tokenGroup/actions.ts index 8fd56066c10..318c49fe8fe 100644 --- a/token/js/src/extensions/tokenGroup/actions.ts +++ b/token/js/src/extensions/tokenGroup/actions.ts @@ -35,7 +35,7 @@ export async function tokenGroupInitializeGroup( mint: PublicKey, mintAuthority: PublicKey | Signer, updateAuthority: PublicKey | null, - maxSize: number, + maxSize: bigint, multiSigners: Signer[] = [], confirmOptions?: ConfirmOptions, programId = TOKEN_2022_PROGRAM_ID, @@ -79,7 +79,7 @@ export async function tokenGroupInitializeGroupWithRentTransfer( mint: PublicKey, mintAuthority: PublicKey | Signer, updateAuthority: PublicKey | null, - maxSize: number, + maxSize: bigint, multiSigners: Signer[] = [], confirmOptions?: ConfirmOptions, programId = TOKEN_2022_PROGRAM_ID, @@ -126,7 +126,7 @@ export async function tokenGroupUpdateGroupMaxSize( payer: Signer, mint: PublicKey, updateAuthority: PublicKey | Signer, - maxSize: number, + maxSize: bigint, multiSigners: Signer[] = [], confirmOptions?: ConfirmOptions, programId = TOKEN_2022_PROGRAM_ID, diff --git a/token/js/test/e2e-2022/tokenGroup.test.ts b/token/js/test/e2e-2022/tokenGroup.test.ts index 3b85a570564..45dd9713382 100644 --- a/token/js/test/e2e-2022/tokenGroup.test.ts +++ b/token/js/test/e2e-2022/tokenGroup.test.ts @@ -76,8 +76,8 @@ describe('tokenGroup', async () => { const tokenGroup = { updateAuthority: updateAuthority.publicKey, mint: mint.publicKey, - size: 0, - maxSize: 10, + size: BigInt(0), + maxSize: BigInt(10), }; // Transfer the required amount for rent exemption @@ -112,8 +112,8 @@ describe('tokenGroup', async () => { const tokenGroup = { updateAuthority: updateAuthority.publicKey, mint: mint.publicKey, - size: 0, - maxSize: 10, + size: BigInt(0), + maxSize: BigInt(10), }; await tokenGroupInitializeGroupWithRentTransfer( @@ -137,8 +137,8 @@ describe('tokenGroup', async () => { const tokenGroup = { updateAuthority: updateAuthority.publicKey, mint: mint.publicKey, - size: 0, - maxSize: 10, + size: BigInt(0), + maxSize: BigInt(10), }; // Transfer the required amount for rent exemption @@ -169,7 +169,7 @@ describe('tokenGroup', async () => { payer, mint.publicKey, updateAuthority.publicKey, - 20, + BigInt(20), [updateAuthority], undefined, TEST_PROGRAM_ID, @@ -180,8 +180,8 @@ describe('tokenGroup', async () => { expect(group).to.deep.equal({ updateAuthority: updateAuthority.publicKey, mint: mint.publicKey, - size: 0, - maxSize: 20, + size: BigInt(0), + maxSize: BigInt(20), }); }); @@ -189,8 +189,8 @@ describe('tokenGroup', async () => { const tokenGroup = { updateAuthority: updateAuthority.publicKey, mint: mint.publicKey, - size: 0, - maxSize: 10, + size: BigInt(0), + maxSize: BigInt(10), }; // Transfer the required amount for rent exemption diff --git a/token/js/test/e2e-2022/tokenGroupMember.test.ts b/token/js/test/e2e-2022/tokenGroupMember.test.ts index 727a5a8623b..ddcf01b6123 100644 --- a/token/js/test/e2e-2022/tokenGroupMember.test.ts +++ b/token/js/test/e2e-2022/tokenGroupMember.test.ts @@ -83,7 +83,7 @@ describe('tokenGroupMember', async () => { groupMint.publicKey, groupMintAuthority.publicKey, groupUpdateAuthority.publicKey, - 3, + BigInt(3), [payer, groupMintAuthority], undefined, TEST_PROGRAM_ID, From 9b4ea2bae1610e3b46048209b98934bda28087e8 Mon Sep 17 00:00:00 2001 From: Jackson Doherty Date: Sun, 11 Aug 2024 13:07:22 -0400 Subject: [PATCH 8/8] Update additional e2e tests --- token/js/test/e2e-2022/tokenGroup.test.ts | 4 ++-- token/js/test/e2e-2022/tokenGroupMember.test.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/token/js/test/e2e-2022/tokenGroup.test.ts b/token/js/test/e2e-2022/tokenGroup.test.ts index 45dd9713382..b076f8ac55d 100644 --- a/token/js/test/e2e-2022/tokenGroup.test.ts +++ b/token/js/test/e2e-2022/tokenGroup.test.ts @@ -233,8 +233,8 @@ describe('tokenGroup', async () => { expect(group).to.deep.equal({ updateAuthority: newUpdateAuthority.publicKey, mint: mint.publicKey, - size: 0, - maxSize: 10, + size: BigInt(0), + maxSize: BigInt(10), }); }); }); diff --git a/token/js/test/e2e-2022/tokenGroupMember.test.ts b/token/js/test/e2e-2022/tokenGroupMember.test.ts index ddcf01b6123..07cee386132 100644 --- a/token/js/test/e2e-2022/tokenGroupMember.test.ts +++ b/token/js/test/e2e-2022/tokenGroupMember.test.ts @@ -123,7 +123,7 @@ describe('tokenGroupMember', async () => { const tokenGroupMember = { mint: memberMint.publicKey, group: groupMint.publicKey, - memberNumber: 1, + memberNumber: BigInt(1), }; await tokenGroupMemberInitializeWithRentTransfer(