@@ -11,7 +11,6 @@ import (
1111
1212 "github.com/libp2p/go-libp2p/core/crypto"
1313 coreda "github.com/rollkit/rollkit/core/da"
14- coresequencer "github.com/rollkit/rollkit/core/sequencer"
1514 "github.com/rollkit/rollkit/pkg/cache"
1615 "github.com/rollkit/rollkit/pkg/config"
1716 "github.com/rollkit/rollkit/pkg/signer/noop"
@@ -41,13 +40,11 @@ func newTestManagerWithDA(t *testing.T, da *mocks.DA) (m *Manager) {
4140 }
4241}
4342
44- // TestSubmitBatchToDA_Success verifies that submitBatchToDA succeeds when the DA layer accepts the batch.
45- func TestSubmitBatchToDA_Success (t * testing.T ) {
43+ // TestSubmitDataToDA_Success verifies that submitDataToDA succeeds when the DA layer accepts the batch.
44+ func TestSubmitDataToDA_Success (t * testing.T ) {
4645 da := & mocks.DA {}
4746 m := newTestManagerWithDA (t , da )
4847
49- batch := coresequencer.Batch {Transactions : [][]byte {[]byte ("tx1" ), []byte ("tx2" )}}
50-
5148 // Simulate DA success
5249 da .On ("GasMultiplier" , mock .Anything ).Return (2.0 , nil )
5350 da .On ("SubmitWithOptions" , mock .Anything , mock .Anything , mock .Anything , mock .Anything , mock .Anything ).
@@ -58,36 +55,36 @@ func TestSubmitBatchToDA_Success(t *testing.T) {
5855 addr , err := m .signer .GetAddress ()
5956 require .NoError (t , err )
6057
58+ transactions := [][]byte {[]byte ("tx1" ), []byte ("tx2" )}
59+
6160 signedData := types.SignedData {
6261 Data : types.Data {
63- Txs : make (types.Txs , len (batch . Transactions )),
62+ Txs : make (types.Txs , len (transactions )),
6463 },
6564 Signer : types.Signer {
6665 Address : addr ,
6766 PubKey : pubKey ,
6867 },
6968 }
7069
71- signedData .Txs = make (types.Txs , len (batch . Transactions ))
72- for i , tx := range batch . Transactions {
70+ signedData .Txs = make (types.Txs , len (transactions ))
71+ for i , tx := range transactions {
7372 signedData .Txs [i ] = types .Tx (tx )
7473 }
7574
7675 signature , err := m .getDataSignature (& signedData .Data )
7776 require .NoError (t , err )
7877 signedData .Signature = signature
7978
80- err = m .submitBatchToDA (context .Background (), & signedData )
79+ err = m .submitDataToDA (context .Background (), & signedData )
8180 assert .NoError (t , err )
8281}
8382
84- // TestSubmitBatchToDA_Failure verifies that submitBatchToDA returns an error for various DA failures.
85- func TestSubmitBatchToDA_Failure (t * testing.T ) {
83+ // TestSubmitDataToDA_Failure verifies that submitDataToDA returns an error for various DA failures.
84+ func TestSubmitDataToDA_Failure (t * testing.T ) {
8685 da := & mocks.DA {}
8786 m := newTestManagerWithDA (t , da )
8887
89- batch := coresequencer.Batch {Transactions : [][]byte {[]byte ("tx1" ), []byte ("tx2" )}}
90-
9188 // Table-driven test for different DA error scenarios
9289 testCases := []struct {
9390 name string
@@ -110,18 +107,20 @@ func TestSubmitBatchToDA_Failure(t *testing.T) {
110107 addr , err := m .signer .GetAddress ()
111108 require .NoError (t , err )
112109
110+ transactions := [][]byte {[]byte ("tx1" ), []byte ("tx2" )}
111+
113112 signedData := types.SignedData {
114113 Data : types.Data {
115- Txs : make (types.Txs , len (batch . Transactions )),
114+ Txs : make (types.Txs , len (transactions )),
116115 },
117116 Signer : types.Signer {
118117 Address : addr ,
119118 PubKey : pubKey ,
120119 },
121120 }
122121
123- signedData .Txs = make (types.Txs , len (batch . Transactions ))
124- for i , tx := range batch . Transactions {
122+ signedData .Txs = make (types.Txs , len (transactions ))
123+ for i , tx := range transactions {
125124 signedData .Txs [i ] = types .Tx (tx )
126125 }
127126
@@ -130,7 +129,7 @@ func TestSubmitBatchToDA_Failure(t *testing.T) {
130129 signedData .Signature = signature
131130
132131 // Expect an error from submitBatchToDA
133- err = m .submitBatchToDA (context .Background (), & signedData )
132+ err = m .submitDataToDA (context .Background (), & signedData )
134133 assert .Error (t , err , "expected error" )
135134 })
136135 }
0 commit comments