@@ -124,7 +124,7 @@ func TestSubmitter_IsHeightDAIncluded(t *testing.T) {
124124
125125 h1 , d1 := newHeaderAndData ("chain" , 3 , true )
126126 h2 , d2 := newHeaderAndData ("chain" , 4 , true )
127- h3 , d3 := newHeaderAndData ("chain" , 2 , true ) // already DA included, cache was cleared
127+ _ , d3 := newHeaderAndData ("chain" , 2 , true ) // already DA included, cache was cleared
128128
129129 cm .SetHeaderDAIncluded (h1 .Hash ().String (), 100 , 3 )
130130 cm .SetDataDAIncluded (d1 .DACommitment ().String (), 100 , 3 )
@@ -134,21 +134,20 @@ func TestSubmitter_IsHeightDAIncluded(t *testing.T) {
134134
135135 specs := map [string ]struct {
136136 height uint64
137- header * types.SignedHeader
138137 data * types.Data
139138 exp bool
140139 expErr bool
141140 }{
142- "below store height and cached" : {height : 3 , header : h1 , data : d1 , exp : true },
143- "above store height" : {height : 6 , header : h2 , data : d2 , exp : false },
144- "data missing" : {height : 4 , header : h2 , data : d2 , exp : false },
145- "at daIncludedHeight - cache cleared" : {height : 2 , header : h3 , data : d3 , exp : true },
146- "below daIncludedHeight - cache cleared" : {height : 1 , header : h3 , data : d3 , exp : true },
141+ "below store height and cached" : {height : 3 , data : d1 , exp : true },
142+ "above store height" : {height : 6 , data : d2 , exp : false },
143+ "data missing" : {height : 4 , data : d2 , exp : false },
144+ "at daIncludedHeight - cache cleared" : {height : 2 , data : d3 , exp : true },
145+ "below daIncludedHeight - cache cleared" : {height : 1 , data : d3 , exp : true },
147146 }
148147
149148 for name , spec := range specs {
150149 t .Run (name , func (t * testing.T ) {
151- included , err := s .IsHeightDAIncluded (spec .height , spec .header , spec . data )
150+ included , err := s .IsHeightDAIncluded (spec .height , spec .data )
152151 if spec .expErr {
153152 require .Error (t , err )
154153 return
@@ -200,7 +199,7 @@ func TestSubmitter_setSequencerHeightToDAHeight(t *testing.T) {
200199 mockStore .On ("SetMetadata" , mock .Anything , dataKey , dBz ).Return (nil ).Once ()
201200 mockStore .On ("SetMetadata" , mock .Anything , store .GenesisDAHeightKey , gBz ).Return (nil ).Once ()
202201
203- require .NoError (t , s .setNodeHeightToDAHeight (ctx , 1 , h , d , true ))
202+ require .NoError (t , s .setNodeHeightToDAHeight (ctx , 1 , d , true ))
204203}
205204
206205func TestSubmitter_setNodeHeightToDAHeight_Errors (t * testing.T ) {
@@ -214,11 +213,11 @@ func TestSubmitter_setNodeHeightToDAHeight_Errors(t *testing.T) {
214213 // No cache entries -> expect error on missing header
215214 _ , ok := cm .GetHeaderDAIncluded (h .Hash ().String ())
216215 assert .False (t , ok )
217- assert .Error (t , s .setNodeHeightToDAHeight (ctx , 1 , h , d , false ))
216+ assert .Error (t , s .setNodeHeightToDAHeight (ctx , 1 , d , false ))
218217
219218 // Add header, missing data
220219 cm .SetHeaderDAIncluded (h .Hash ().String (), 10 , 1 )
221- assert .Error (t , s .setNodeHeightToDAHeight (ctx , 1 , h , d , false ))
220+ assert .Error (t , s .setNodeHeightToDAHeight (ctx , 1 , d , false ))
222221}
223222
224223func TestSubmitter_initializeDAIncludedHeight (t * testing.T ) {
@@ -649,7 +648,7 @@ func TestSubmitter_IsHeightDAIncluded_AfterRestart(t *testing.T) {
649648 _ , realHeaderFound := cm2 .GetHeaderDAIncluded (h3 .Hash ().String ())
650649 assert .False (t , realHeaderFound , "real hash must not be present before DA retriever re-fires" )
651650
652- included , err := s .IsHeightDAIncluded (3 , h3 , d3 )
651+ included , err := s .IsHeightDAIncluded (3 , d3 )
653652 require .NoError (t , err )
654653 assert .True (t , included ,
655654 "IsHeightDAIncluded must return true for in-flight height using snapshot placeholder, " +
@@ -662,7 +661,7 @@ func TestSubmitter_IsHeightDAIncluded_AfterRestart(t *testing.T) {
662661 _ , realHeaderFound = cm2 .GetHeaderDAIncluded (h3 .Hash ().String ())
663662 assert .True (t , realHeaderFound , "real hash must be present after DA retriever re-fires" )
664663
665- included , err = s .IsHeightDAIncluded (3 , h3 , d3 )
664+ included , err = s .IsHeightDAIncluded (3 , d3 )
666665 require .NoError (t , err )
667666 assert .True (t , included , "IsHeightDAIncluded must still return true after real hash is written" )
668667}
@@ -675,9 +674,9 @@ func TestSubmitter_IsHeightDAIncluded_AfterRestart(t *testing.T) {
675674// The bug this guards against:
676675// - Snapshot encodes [blockHeight → daHeight] pairs, not real content hashes.
677676// - On restart, RestoreFromStore installs placeholder keys (indexed by height).
678- // - setNodeHeightToDAHeight calls GetHeaderDAIncluded(realHash) which MISSES.
679- // - Without the height-based fallback it returns an error and processDAInclusionLoop
680- // logs the error and stalls — the submitter can never write HeightToDAHeight
677+ // - setNodeHeightToDAHeight uses GetHeaderDAIncludedByHeight which resolves
678+ // the placeholder entry directly, so it succeeds before the DA retriever
679+ // re-fires SetHeaderDAIncluded with the real content hash.
681680// metadata and DAIncludedHeight never advances.
682681// - With GetHeaderDAIncludedByHeight / GetDataDAIncludedByHeight the lookup
683682// succeeds via the placeholder and the metadata is written correctly.
@@ -735,9 +734,9 @@ func TestSubmitter_setNodeHeightToDAHeight_AfterRestart(t *testing.T) {
735734 // ── Step 3: call setNodeHeightToDAHeight — must succeed via fallback ──────
736735 // Before this fix, GetHeaderDAIncluded(realHash) would miss and the function
737736 // would return an error, stalling processDAInclusionLoop.
738- err = s .setNodeHeightToDAHeight (ctx , 3 , h3 , d3 , false )
737+ err = s .setNodeHeightToDAHeight (ctx , 3 , d3 , false )
739738 require .NoError (t , err ,
740- "setNodeHeightToDAHeight must succeed via height-based fallback before DA retriever re-fires" )
739+ "setNodeHeightToDAHeight must succeed via height-based lookup before DA retriever re-fires" )
741740
742741 // ── Step 4: verify the HeightToDAHeight metadata was written correctly ─────
743742 headerDABz , err := st1 .GetMetadata (ctx , store .GetHeightToDAHeightHeaderKey (3 ))
@@ -756,6 +755,6 @@ func TestSubmitter_setNodeHeightToDAHeight_AfterRestart(t *testing.T) {
756755 cm2 .SetHeaderDAIncluded (h3 .Hash ().String (), 12 , 3 )
757756 cm2 .SetDataDAIncluded (d3 .DACommitment ().String (), 12 , 3 )
758757
759- err = s .setNodeHeightToDAHeight (ctx , 3 , h3 , d3 , false )
758+ err = s .setNodeHeightToDAHeight (ctx , 3 , d3 , false )
760759 require .NoError (t , err , "setNodeHeightToDAHeight must still work once real hashes are populated" )
761760}
0 commit comments