@@ -1618,6 +1618,7 @@ func Test_Builder_MultiReport(t *testing.T) {
16181618 expectedChainReportsPerExec []int
16191619 // Map tracking which sequence numbers to skip per chain selector
16201620 expectedSkippedSeqsByChain map [cciptypes.ChainSelector ]mapset.Set [cciptypes.SeqNum ]
1621+ overrideMaxReportsCount uint64
16211622 wantErr string
16221623 }{
16231624 {
@@ -1762,6 +1763,49 @@ func Test_Builder_MultiReport(t *testing.T) {
17621763 expectedExecReports : 4 ,
17631764 expectedChainReportsPerExec : []int {1 , 1 , 1 , 1 }, // Each report has one chain report
17641765 },
1766+ {
1767+ name : "Solana case with max report count: report multiple reports when input multiple" +
1768+ " reports with single message each" ,
1769+ args : args {
1770+ maxReportSize : 2800 ,
1771+ maxGasLimit : 10000000 ,
1772+ maxMessages : 1 ,
1773+ maxSingleChainReports : 1 ,
1774+ nonces : defaultNonces ,
1775+ reports : []exectypes.CommitData {
1776+ makeTestCommitReport (hasher , 1 , 2 , 100 , 999 , 10101010101 ,
1777+ sender ,
1778+ cciptypes.Bytes32 {}, // generate a correct root.
1779+ nil , // executed
1780+ true , // zero nonces
1781+ ),
1782+ makeTestCommitReport (hasher , 1 , 2 , 101 , 999 , 10101010101 ,
1783+ sender ,
1784+ cciptypes.Bytes32 {}, // generate a correct root.
1785+ nil , // executed
1786+ true , // zero nonces
1787+ ),
1788+ makeTestCommitReport (hasher , 1 , 2 , 102 , 999 , 10101010101 ,
1789+ sender ,
1790+ cciptypes.Bytes32 {}, // generate a correct root.
1791+ nil , // executed
1792+ true , // zero nonces
1793+ ),
1794+ makeTestCommitReport (hasher , 1 , 2 , 103 , 999 , 10101010101 ,
1795+ sender ,
1796+ cciptypes.Bytes32 {}, // generate a correct root.
1797+ nil , // executed
1798+ true , // zero nonces
1799+ ),
1800+ },
1801+ },
1802+ overrideMaxReportsCount : 2 ,
1803+ expectedExecReports : 2 ,
1804+ expectedChainReportsPerExec : []int {1 , 1 }, // Each report has one chain report
1805+ expectedSkippedSeqsByChain : map [cciptypes.ChainSelector ]mapset.Set [cciptypes.SeqNum ]{
1806+ 2 : mapset .NewSet (cciptypes .SeqNum (102 ), cciptypes .SeqNum (103 )),
1807+ },
1808+ },
17651809 {
17661810 name : "multiple reports - max single chain reports" ,
17671811 args : args {
@@ -1860,6 +1904,30 @@ func Test_Builder_MultiReport(t *testing.T) {
18601904 2 : mapset .NewSet (cciptypes .SeqNum (101 ), cciptypes .SeqNum (103 )),
18611905 },
18621906 },
1907+ {
1908+ name : "report max count limit" ,
1909+ args : args {
1910+ maxReportSize : 2800 ,
1911+ maxGasLimit : 10000000 ,
1912+ maxMessages : 1 ,
1913+ maxSingleChainReports : 1 ,
1914+ nonces : defaultNonces ,
1915+ reports : []exectypes.CommitData {
1916+ makeTestCommitReport (hasher , 6 , 2 , 100 , 999 , 10101010101 ,
1917+ sender ,
1918+ cciptypes.Bytes32 {}, // generate a correct root.
1919+ nil , // executed
1920+ true , // zero nonces
1921+ ),
1922+ },
1923+ },
1924+ overrideMaxReportsCount : 4 ,
1925+ expectedExecReports : 4 ,
1926+ expectedChainReportsPerExec : []int {1 , 1 , 1 , 1 }, // Each report has one chain report
1927+ expectedSkippedSeqsByChain : map [cciptypes.ChainSelector ]mapset.Set [cciptypes.SeqNum ]{
1928+ 2 : mapset .NewSet [cciptypes.SeqNum ](104 , 105 ),
1929+ },
1930+ },
18631931 }
18641932
18651933 mockAddrCodec := internal .NewMockAddressCodecHex (t )
@@ -1872,6 +1940,11 @@ func Test_Builder_MultiReport(t *testing.T) {
18721940 ep .EXPECT ().CalculateMessageMaxGas (mock .Anything ).Return (uint64 (0 )).Maybe ()
18731941 ep .EXPECT ().CalculateMerkleTreeGas (mock .Anything ).Return (uint64 (0 )).Maybe ()
18741942
1943+ maxReportCount := uint64 (10 )
1944+ if tt .overrideMaxReportsCount > 0 {
1945+ maxReportCount = tt .overrideMaxReportsCount
1946+ }
1947+
18751948 builder := NewBuilder (
18761949 lggr ,
18771950 hasher ,
@@ -1885,7 +1958,7 @@ func Test_Builder_MultiReport(t *testing.T) {
18851958 WithMaxSingleChainReports (tt .args .maxSingleChainReports ),
18861959 WithExtraMessageCheck (CheckNonces (tt .args .nonces , mockAddrCodec )),
18871960 WithMultipleReports (true ), // all tests are for multi reports
1888- WithMaxReportsCount (10 ),
1961+ WithMaxReportsCount (maxReportCount ),
18891962 )
18901963
18911964 foundError := false
0 commit comments