@@ -404,33 +404,38 @@ func BenchmarkTransactionVerifySignatures(b *testing.B) {
404404// serialization is deterministic when using TransactionDeterministicOrdering with
405405// multiple address lookup tables.
406406func TestNewTransactionWithAddressLookupTables_Deterministic (t * testing.T ) {
407- // Define two lookup tables with different addresses
407+ // Define two lookup tables
408408 lookupTable1 := MustPublicKeyFromBase58 ("8Vaso6eE1pWktDHwy2qQBB1fhjmBgwzhoXQKe1sxtFjn" )
409409 lookupTable2 := MustPublicKeyFromBase58 ("FqtwFavD9v99FvoaZrY14bGatCQa9ChsMVphEUNAWHeG" )
410410
411- // Addresses in lookup table 1
411+ // Addresses unique to lookup table 1
412412 addr1InTable1 := MustPublicKeyFromBase58 ("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" )
413413 addr2InTable1 := MustPublicKeyFromBase58 ("JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4" )
414414
415- // Addresses in lookup table 2
415+ // Addresses unique to lookup table 2
416416 addr1InTable2 := MustPublicKeyFromBase58 ("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" )
417417 addr2InTable2 := MustPublicKeyFromBase58 ("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" )
418418
419+ // Shared address that exists in BOTH tables - tests that deterministic
420+ // ordering consistently picks the same table when an address appears in multiple
421+ sharedAddr := MustPublicKeyFromBase58 ("So11111111111111111111111111111111111111112" )
422+
419423 // Fee payer and program
420424 feePayer := MustPublicKeyFromBase58 ("7KxrPswMgoVFwC1K7KmudEW9KzmVUCdBnLBMaSAjYQGp" )
421425 programID := MustPublicKeyFromBase58 ("11111111111111111111111111111111" )
422426
423427 addressTables := map [PublicKey ]PublicKeySlice {
424- lookupTable1 : {addr1InTable1 , addr2InTable1 },
425- lookupTable2 : {addr1InTable2 , addr2InTable2 },
428+ lookupTable1 : {addr1InTable1 , addr2InTable1 , sharedAddr },
429+ lookupTable2 : {sharedAddr , addr1InTable2 , addr2InTable2 }, // sharedAddr at different index
426430 }
427431
428- // Create instruction that uses accounts from both lookup tables
432+ // Create instruction that uses accounts from both lookup tables, including the shared address
429433 instruction := & testTransactionInstructions {
430434 accounts : []* AccountMeta {
431435 {PublicKey : feePayer , IsSigner : true , IsWritable : true },
432436 {PublicKey : addr1InTable1 , IsSigner : false , IsWritable : false },
433437 {PublicKey : addr2InTable1 , IsSigner : false , IsWritable : true },
438+ {PublicKey : sharedAddr , IsSigner : false , IsWritable : true }, // shared address
434439 {PublicKey : addr1InTable2 , IsSigner : false , IsWritable : false },
435440 {PublicKey : addr2InTable2 , IsSigner : false , IsWritable : true },
436441 },
0 commit comments