@@ -26,6 +26,7 @@ import (
2626 "github.com/evstack/ev-node/pkg/signer/file"
2727 "github.com/evstack/ev-node/pkg/sequencers/solo"
2828 "github.com/evstack/ev-node/pkg/store"
29+ datypes "github.com/evstack/ev-node/pkg/da/types"
2930
3031 "github.com/celestiaorg/celestia-node/api/client"
3132
@@ -49,8 +50,10 @@ const (
4950// - Starts a single-validator Celestia chain + Fibre server + bridge
5051// - Creates a celestia-node-fiber adapter (block.FiberClient)
5152// - Constructs an ev-node aggregator node that uses the adapter as DA
53+ // - Subscribes to the data namespace via adapter.Listen before uploading
5254// - Injects a transaction and waits for block production
53- // - Verifies the executor processed the block (blocksProduced >= 1)
55+ // - Confirms the DA submitter pushed blobs to Fiber by receiving events
56+ // on the subscription and round-tripping each through Download
5457func TestEvNode_FiberDA_Posting (t * testing.T ) {
5558 ctx , cancel := context .WithTimeout (context .Background (), 3 * time .Minute )
5659 t .Cleanup (cancel )
@@ -77,6 +80,16 @@ func TestEvNode_FiberDA_Posting(t *testing.T) {
7780 require .NoError (t , err , "constructing adapter" )
7881 t .Cleanup (func () { _ = adapter .Close () })
7982
83+ // Subscribe to the header namespace BEFORE starting the node so we
84+ // don't race against the first DA submission. fromHeight=0 follows
85+ // the live tip. The adapter expects the 10-byte v0 namespace ID
86+ // (the last 10 bytes of the full 29-byte namespace), matching what
87+ // fiberDAClient.Submit extracts before calling fiber.Upload.
88+ fullHeaderNS := datypes .NamespaceFromString (evnodeHeaderNS ).Bytes ()
89+ headerNSID := fullHeaderNS [len (fullHeaderNS )- 10 :]
90+ events , err := adapter .Listen (ctx , headerNSID , 0 )
91+ require .NoError (t , err , "starting fiber Listen on header namespace" )
92+
8093 rollnode , exec , nodeCleanup := newFiberEvNode (t , ctx , adapter )
8194 t .Cleanup (nodeCleanup )
8295
@@ -99,6 +112,32 @@ func TestEvNode_FiberDA_Posting(t *testing.T) {
99112 return stats .BlocksProduced >= 1 && stats .TotalExecutedTxs >= 1
100113 }, evnodeBlockTimeout , 200 * time .Millisecond , "ev-node should produce at least one block with the transaction" )
101114
115+ // Drain at least one Fiber BlobEvent from the subscription to prove
116+ // the DA submitter pushed data through the fiber adapter's Upload
117+ // path and the settlement landed on-chain.
118+ var seen []block.FiberBlobEvent
119+ require .Eventually (t , func () bool {
120+ select {
121+ case ev , ok := <- events :
122+ if ! ok {
123+ return false
124+ }
125+ seen = append (seen , ev )
126+ t .Logf ("fiber event: blob_id=%x height=%d data_size=%d" ,
127+ ev .BlobID , ev .Height , ev .DataSize )
128+ return true
129+ default :
130+ return false
131+ }
132+ }, evnodeBlockTimeout , 500 * time .Millisecond , "expected at least one Fiber BlobEvent from DA submission" )
133+
134+ for _ , ev := range seen {
135+ got , err := adapter .Download (ctx , ev .BlobID )
136+ require .NoError (t , err , "adapter.Download blob_id=%x" , ev .BlobID )
137+ require .NotEmpty (t , got , "downloaded blob must not be empty" )
138+ t .Logf ("download ok: blob_id=%x bytes=%d" , ev .BlobID , len (got ))
139+ }
140+
102141 select {
103142 case err := <- nodeErrCh :
104143 t .Fatalf ("node exited unexpectedly: %v" , err )
0 commit comments