@@ -225,6 +225,7 @@ type Chain struct {
225225 nextFeeCID string // holding CID to be used as fee on next message send
226226 transferTokenInstrument * splice_api_token_holding_v1.InstrumentId
227227 nextTransferCID string // holding CID to be used as transfer on next message send
228+ rotationEndSeq uint64 // last on-chain seq in current setup batch; 0 = always rotate
228229
229230 // verifierObs is injected post-construction by test runners (see SetVerifierObservation).
230231 // Required by ConfirmExecOnDest to fetch verifier results from indexer (aggregator optional).
@@ -1113,6 +1114,17 @@ func (c *Chain) SetupSend(
11131114 return nil
11141115}
11151116
1117+ // SetSequentialSends limits holding rotation to the next sends messages in this setup batch.
1118+ // After the send whose on-chain seq equals nextSeq+sends, setNextHoldings is skipped.
1119+ // Pass 0 to always rotate (open-ended load).
1120+ func (c * Chain ) SetSequentialSends (sends int ) {
1121+ if sends <= 0 {
1122+ c .rotationEndSeq = 0
1123+ return
1124+ }
1125+ c .rotationEndSeq = uint64 (sends )
1126+ }
1127+
11161128// MintTokens mint tokens for transfer and fees. To be used on devenv tests only.
11171129// this method won't work in staging/prod tests
11181130func (c * Chain ) MintTokens (ctx context.Context , amount * big.Rat ) error {
@@ -1451,12 +1463,6 @@ func (c *Chain) SendMessage(ctx context.Context, dest uint64, fields cciptestint
14511463 Uint64 ("seqNo" , parsedSend .seqNo ).
14521464 Msg ("CCIP Send executed" )
14531465
1454- // Set next holdings
1455- err = c .setNextHoldings (update .GetTransaction ().GetEvents (), hasTokenTransfer , new (big.Rat ).SetFrac (fields .TokenAmount .Amount , big .NewInt (CantonFixedPointScale )))
1456- if err != nil {
1457- return cciptestinterfaces.MessageSentEvent {}, fmt .Errorf ("set next holdings: %w" , err )
1458- }
1459-
14601466 event := cciptestinterfaces.MessageSentEvent {
14611467 MessageID : parsedSend .messageID ,
14621468 ReceiptIssuers : nil , // TODO: add them later, not currently needed
@@ -1469,6 +1475,21 @@ func (c *Chain) SendMessage(ctx context.Context, dest uint64, fields cciptestint
14691475 c .lastSentSeq = parsedSend .seqNo
14701476 c .lastSentEvent = event
14711477
1478+ // Case it's the last send
1479+ if c .rotationEndSeq == 0 {
1480+ c .logger .Info ().
1481+ Uint64 ("rotationEndSeq" , c .rotationEndSeq ).
1482+ Msg ("Skipping holding rotation after last planned send in batch" )
1483+
1484+ return event , nil
1485+ }
1486+
1487+ c .rotationEndSeq --
1488+ err = c .setNextHoldings (update .GetTransaction ().GetEvents (), hasTokenTransfer , new (big.Rat ).SetFrac (fields .TokenAmount .Amount , big .NewInt (CantonFixedPointScale )))
1489+ if err != nil {
1490+ return cciptestinterfaces.MessageSentEvent {}, fmt .Errorf ("set next holdings: %w" , err )
1491+ }
1492+
14721493 return event , nil
14731494}
14741495
0 commit comments