@@ -45,12 +45,14 @@ func TestSubmitToDA_MempoolRetry_IncreasesGasAndSucceeds(t *testing.T) {
4545
4646 // First attempt returns a mempool-related error (mapped to StatusNotIncludedInBlock)
4747 // Expect gasPrice=1.0
48- ns := []byte ("ns" )
48+
49+ nsBz := coreda .NamespaceFromString ("ns" ).Bytes ()
50+
4951 opts := []byte ("opts" )
5052 // capture gas prices used
5153 var usedGas []float64
5254 mockDA .
53- On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .AnythingOfType ("float64" ), ns , opts ).
55+ On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .AnythingOfType ("float64" ), nsBz , opts ).
5456 Run (func (args mock.Arguments ) {
5557 usedGas = append (usedGas , args .Get (2 ).(float64 ))
5658 }).
@@ -60,7 +62,7 @@ func TestSubmitToDA_MempoolRetry_IncreasesGasAndSucceeds(t *testing.T) {
6062 // Second attempt should use doubled gas price = 2.0 and succeed for all items
6163 ids := [][]byte {[]byte ("id1" ), []byte ("id2" ), []byte ("id3" )}
6264 mockDA .
63- On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .AnythingOfType ("float64" ), ns , opts ).
65+ On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .AnythingOfType ("float64" ), nsBz , opts ).
6466 Run (func (args mock.Arguments ) {
6567 usedGas = append (usedGas , args .Get (2 ).(float64 ))
6668 }).
@@ -81,7 +83,7 @@ func TestSubmitToDA_MempoolRetry_IncreasesGasAndSucceeds(t *testing.T) {
8183 marshalString ,
8284 func (_ []string , _ * coreda.ResultSubmit , _ float64 ) {},
8385 "item" ,
84- ns ,
86+ nsBz ,
8587 opts ,
8688 nil ,
8789 )
@@ -99,21 +101,22 @@ func TestSubmitToDA_UnknownError_RetriesSameGasThenSucceeds(t *testing.T) {
99101 // Initial gas price comes from config (set below), so DA.GasPrice is not called
100102 mockDA .On ("GasMultiplier" , mock .Anything ).Return (3.0 , nil ).Once ()
101103
102- ns := []byte ("ns" )
104+ nsBz := coreda .NamespaceFromString ("ns" ).Bytes ()
105+
103106 opts := []byte ("opts" )
104107 var usedGas []float64
105108
106109 // First attempt: unknown failure -> reasonFailure, gas unchanged for next attempt
107110 mockDA .
108- On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .AnythingOfType ("float64" ), ns , opts ).
111+ On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .AnythingOfType ("float64" ), nsBz , opts ).
109112 Run (func (args mock.Arguments ) { usedGas = append (usedGas , args .Get (2 ).(float64 )) }).
110113 Return (nil , errors .New ("boom" )).
111114 Once ()
112115
113116 // Second attempt: same gas, success
114117 ids := [][]byte {[]byte ("id1" )}
115118 mockDA .
116- On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .AnythingOfType ("float64" ), ns , opts ).
119+ On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .AnythingOfType ("float64" ), nsBz , opts ).
117120 Run (func (args mock.Arguments ) { usedGas = append (usedGas , args .Get (2 ).(float64 )) }).
118121 Return (ids , nil ).
119122 Once ()
@@ -131,7 +134,7 @@ func TestSubmitToDA_UnknownError_RetriesSameGasThenSucceeds(t *testing.T) {
131134 marshalString ,
132135 func (_ []string , _ * coreda.ResultSubmit , _ float64 ) {},
133136 "item" ,
134- ns ,
137+ nsBz ,
135138 opts ,
136139 nil ,
137140 )
@@ -147,14 +150,15 @@ func TestSubmitToDA_TooBig_HalvesBatch(t *testing.T) {
147150 // Use fixed gas from config to simplify
148151 mockDA .On ("GasMultiplier" , mock .Anything ).Return (2.0 , nil ).Once ()
149152
150- ns := []byte ("ns" )
153+ nsBz := coreda .NamespaceFromString ("ns" ).Bytes ()
154+
151155 opts := []byte ("opts" )
152156 // record sizes of batches sent to DA
153157 var batchSizes []int
154158
155159 // First attempt: too big -> should halve and retry
156160 mockDA .
157- On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .Anything , ns , opts ).
161+ On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .Anything , nsBz , opts ).
158162 Run (func (args mock.Arguments ) {
159163 blobs := args .Get (1 ).([][]byte )
160164 batchSizes = append (batchSizes , len (blobs ))
@@ -165,7 +169,7 @@ func TestSubmitToDA_TooBig_HalvesBatch(t *testing.T) {
165169 // Second attempt: expect half the size, succeed
166170 ids := [][]byte {[]byte ("id1" ), []byte ("id2" )}
167171 mockDA .
168- On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .Anything , ns , opts ).
172+ On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .Anything , nsBz , opts ).
169173 Run (func (args mock.Arguments ) {
170174 blobs := args .Get (1 ).([][]byte )
171175 batchSizes = append (batchSizes , len (blobs ))
@@ -186,7 +190,7 @@ func TestSubmitToDA_TooBig_HalvesBatch(t *testing.T) {
186190 marshalString ,
187191 func (_ []string , _ * coreda.ResultSubmit , _ float64 ) {},
188192 "item" ,
189- ns ,
193+ nsBz ,
190194 opts ,
191195 nil ,
192196 )
@@ -202,21 +206,22 @@ func TestSubmitToDA_SentinelNoGas_PreservesGasAcrossRetries(t *testing.T) {
202206 // GasMultiplier is still called once, but should not affect gas when sentinel is used
203207 mockDA .On ("GasMultiplier" , mock .Anything ).Return (10.0 , nil ).Once ()
204208
205- ns := []byte ("ns" )
209+ nsBz := coreda .NamespaceFromString ("ns" ).Bytes ()
210+
206211 opts := []byte ("opts" )
207212 var usedGas []float64
208213
209214 // First attempt: mempool-ish error
210215 mockDA .
211- On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .AnythingOfType ("float64" ), ns , opts ).
216+ On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .AnythingOfType ("float64" ), nsBz , opts ).
212217 Run (func (args mock.Arguments ) { usedGas = append (usedGas , args .Get (2 ).(float64 )) }).
213218 Return (nil , coreda .ErrTxAlreadyInMempool ).
214219 Once ()
215220
216221 // Second attempt: should use same sentinel gas (-1), succeed
217222 ids := [][]byte {[]byte ("id1" )}
218223 mockDA .
219- On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .AnythingOfType ("float64" ), ns , opts ).
224+ On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .AnythingOfType ("float64" ), nsBz , opts ).
220225 Run (func (args mock.Arguments ) { usedGas = append (usedGas , args .Get (2 ).(float64 )) }).
221226 Return (ids , nil ).
222227 Once ()
@@ -234,7 +239,7 @@ func TestSubmitToDA_SentinelNoGas_PreservesGasAcrossRetries(t *testing.T) {
234239 marshalString ,
235240 func (_ []string , _ * coreda.ResultSubmit , _ float64 ) {},
236241 "item" ,
237- ns ,
242+ nsBz ,
238243 opts ,
239244 nil ,
240245 )
@@ -249,18 +254,19 @@ func TestSubmitToDA_PartialSuccess_AdvancesWindow(t *testing.T) {
249254 mockDA := mocks .NewMockDA (t )
250255 mockDA .On ("GasMultiplier" , mock .Anything ).Return (2.0 , nil ).Once ()
251256
252- ns := []byte ("ns" )
257+ nsBz := coreda .NamespaceFromString ("ns" ).Bytes ()
258+
253259 opts := []byte ("opts" )
254260 // track how many items postSubmit sees across attempts
255261 var totalSubmitted int
256262
257263 // First attempt: success for first 2 of 3
258264 firstIDs := [][]byte {[]byte ("id1" ), []byte ("id2" )}
259- mockDA .On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .Anything , ns , opts ).Return (firstIDs , nil ).Once ()
265+ mockDA .On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .Anything , nsBz , opts ).Return (firstIDs , nil ).Once ()
260266
261267 // Second attempt: success for remaining 1
262268 secondIDs := [][]byte {[]byte ("id3" )}
263- mockDA .On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .Anything , ns , opts ).Return (secondIDs , nil ).Once ()
269+ mockDA .On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .Anything , nsBz , opts ).Return (secondIDs , nil ).Once ()
264270
265271 s := newTestSubmitter (mockDA , func (c * config.Config ) { c .DA .GasPrice = 1.0 })
266272
@@ -273,7 +279,7 @@ func TestSubmitToDA_PartialSuccess_AdvancesWindow(t *testing.T) {
273279 marshalString ,
274280 func (submitted []string , _ * coreda.ResultSubmit , _ float64 ) { totalSubmitted += len (submitted ) },
275281 "item" ,
276- ns ,
282+ nsBz ,
277283 opts ,
278284 nil ,
279285 )
0 commit comments