@@ -1734,7 +1734,11 @@ describe("svm_spoke.bundle", () => {
17341734 } ) ;
17351735
17361736 describe ( "Execute Max multiple refunds with claims" , async ( ) => {
1737- const executeMaxRefundClaims = async ( testConfig : { solanaDistributions : number ; useAddressLookup : boolean } ) => {
1737+ const executeMaxRefundClaims = async ( testConfig : {
1738+ solanaDistributions : number ;
1739+ useAddressLookup : boolean ;
1740+ separatePhases : boolean ;
1741+ } ) => {
17381742 // Add leaves for other EVM chains to have non-empty proofs array to ensure we don't run out of memory when processing.
17391743 const evmDistributions = 100 ; // This would fit in 7 proof array elements.
17401744
@@ -1843,23 +1847,68 @@ describe("svm_spoke.bundle", () => {
18431847 . remainingAccounts ( executeRemainingAccounts )
18441848 . instruction ( ) ;
18451849
1846- // Initialize, execute and claim (except for the first relayer) atomically depending on the chosen method.
1850+ // Initialize, execute and claim (except for the first relayer) depending on the chosen method.
18471851 const instructions = [ ...initializeInstructions , executeInstruction , ...claimInstructions ] ;
1848- if ( testConfig . useAddressLookup )
1849- await sendTransactionWithLookupTable (
1850- connection ,
1851- instructions ,
1852- ( anchor . AnchorProvider . env ( ) . wallet as anchor . Wallet ) . payer
1853- ) ;
1854- else
1855- await web3 . sendAndConfirmTransaction (
1856- connection ,
1857- new web3 . Transaction ( ) . add ( ...instructions ) ,
1858- [ ( anchor . AnchorProvider . env ( ) . wallet as anchor . Wallet ) . payer ] ,
1859- {
1860- commitment : "confirmed" ,
1861- }
1862- ) ;
1852+ if ( ! testConfig . separatePhases ) {
1853+ if ( testConfig . useAddressLookup )
1854+ await sendTransactionWithLookupTable (
1855+ connection ,
1856+ instructions ,
1857+ ( anchor . AnchorProvider . env ( ) . wallet as anchor . Wallet ) . payer
1858+ ) ;
1859+ else
1860+ await web3 . sendAndConfirmTransaction (
1861+ connection ,
1862+ new web3 . Transaction ( ) . add ( ...instructions ) ,
1863+ [ ( anchor . AnchorProvider . env ( ) . wallet as anchor . Wallet ) . payer ] ,
1864+ {
1865+ commitment : "confirmed" ,
1866+ }
1867+ ) ;
1868+ } else {
1869+ if ( testConfig . useAddressLookup ) {
1870+ await sendTransactionWithLookupTable (
1871+ connection ,
1872+ initializeInstructions ,
1873+ ( anchor . AnchorProvider . env ( ) . wallet as anchor . Wallet ) . payer
1874+ ) ;
1875+ await sendTransactionWithLookupTable (
1876+ connection ,
1877+ [ executeInstruction ] ,
1878+ ( anchor . AnchorProvider . env ( ) . wallet as anchor . Wallet ) . payer
1879+ ) ;
1880+ await sendTransactionWithLookupTable (
1881+ connection ,
1882+ claimInstructions ,
1883+ ( anchor . AnchorProvider . env ( ) . wallet as anchor . Wallet ) . payer
1884+ ) ;
1885+ } else {
1886+ await web3 . sendAndConfirmTransaction (
1887+ connection ,
1888+ new web3 . Transaction ( ) . add ( ...initializeInstructions ) ,
1889+ [ ( anchor . AnchorProvider . env ( ) . wallet as anchor . Wallet ) . payer ] ,
1890+ {
1891+ commitment : "confirmed" ,
1892+ }
1893+ ) ;
1894+ await web3 . sendAndConfirmTransaction (
1895+ connection ,
1896+ new web3 . Transaction ( ) . add ( executeInstruction ) ,
1897+ [ ( anchor . AnchorProvider . env ( ) . wallet as anchor . Wallet ) . payer ] ,
1898+ {
1899+ commitment : "confirmed" ,
1900+ }
1901+ ) ;
1902+ await web3 . sendAndConfirmTransaction (
1903+ connection ,
1904+ new web3 . Transaction ( ) . add ( ...claimInstructions ) ,
1905+ [ ( anchor . AnchorProvider . env ( ) . wallet as anchor . Wallet ) . payer ] ,
1906+ {
1907+ commitment : "confirmed" ,
1908+ }
1909+ ) ;
1910+ }
1911+ }
18631912
18641913 // Verify all refund account balances (either token or claim accounts).
18651914 const refundBalances = await Promise . all (
@@ -1877,16 +1926,28 @@ describe("svm_spoke.bundle", () => {
18771926 } ) ;
18781927 } ;
18791928
1880- it ( "Execute Max multiple refunds with claims in legacy transaction" , async ( ) => {
1929+ it ( "Execute Max multiple refunds with claims in one legacy transaction" , async ( ) => {
18811930 // Larger amount would hit transaction message size limit.
18821931 const solanaDistributions = 4 ;
1883- await executeMaxRefundClaims ( { solanaDistributions, useAddressLookup : false } ) ;
1932+ await executeMaxRefundClaims ( { solanaDistributions, useAddressLookup : false , separatePhases : false } ) ;
18841933 } ) ;
18851934
1886- it ( "Execute Max multiple refunds with claims in a versioned transaction" , async ( ) => {
1935+ it ( "Execute Max multiple refunds with claims in one versioned transaction" , async ( ) => {
18871936 // Larger amount would hit transaction message size limit.
18881937 const solanaDistributions = 7 ;
1889- await executeMaxRefundClaims ( { solanaDistributions, useAddressLookup : true } ) ;
1938+ await executeMaxRefundClaims ( { solanaDistributions, useAddressLookup : true , separatePhases : false } ) ;
1939+ } ) ;
1940+
1941+ it ( "Execute Max multiple refunds with claims in separate phase legacy transactions" , async ( ) => {
1942+ // Larger amount would hit transaction message size limit.
1943+ const solanaDistributions = 8 ;
1944+ await executeMaxRefundClaims ( { solanaDistributions, useAddressLookup : false , separatePhases : true } ) ;
1945+ } ) ;
1946+
1947+ it ( "Execute Max multiple refunds with claims in separate phase versioned transactions" , async ( ) => {
1948+ // Larger amount would hit transaction message size limit.
1949+ const solanaDistributions = 13 ;
1950+ await executeMaxRefundClaims ( { solanaDistributions, useAddressLookup : true , separatePhases : true } ) ;
18901951 } ) ;
18911952 } ) ;
18921953} ) ;
0 commit comments