@@ -29,7 +29,11 @@ import (
2929
3030// makeSignedDataBytes builds SignedData containing the provided Data and returns its binary encoding
3131func makeSignedDataBytes (t * testing.T , chainID string , height uint64 , proposer []byte , pub crypto.PubKey , signer signerpkg.Signer , txs int ) ([]byte , * types.SignedData ) {
32- d := & types.Data {Metadata : & types.Metadata {ChainID : chainID , Height : height , Time : uint64 (time .Now ().UnixNano ())}}
32+ return makeSignedDataBytesWithTime (t , chainID , height , proposer , pub , signer , txs , uint64 (time .Now ().UnixNano ()))
33+ }
34+
35+ func makeSignedDataBytesWithTime (t * testing.T , chainID string , height uint64 , proposer []byte , pub crypto.PubKey , signer signerpkg.Signer , txs int , timestamp uint64 ) ([]byte , * types.SignedData ) {
36+ d := & types.Data {Metadata : & types.Metadata {ChainID : chainID , Height : height , Time : timestamp }}
3337 if txs > 0 {
3438 d .Txs = make (types.Txs , txs )
3539 for i := 0 ; i < txs ; i ++ {
@@ -522,11 +526,14 @@ func TestDARetriever_RetrieveForcedIncludedTxsFromDA_ExceedsMaxBlobSize(t *testi
522526
523527 namespaceForcedInclusionBz := coreda .NamespaceFromString (cfg .DA .GetForcedInclusionNamespace ()).Bytes ()
524528
529+ // Use fixed timestamp for deterministic test data
530+ fixedTime := uint64 (1234567890 )
531+
525532 // Create signed data blobs that will exceed DefaultMaxBlobSize when accumulated
526533 // DefaultMaxBlobSize is 1.5MB = 1,572,864 bytes
527534 // Each 700KB tx becomes ~719KB blob, so 2 blobs = ~1.44MB (fits), 3 blobs = ~2.16MB (exceeds)
528535 d1 := & types.Data {
529- Metadata : & types.Metadata {ChainID : gen .ChainID , Height : 10 , Time : uint64 ( time . Now (). UnixNano ()) },
536+ Metadata : & types.Metadata {ChainID : gen .ChainID , Height : 10 , Time : fixedTime },
530537 Txs : make (types.Txs , 1 ),
531538 }
532539 d1 .Txs [0 ] = make ([]byte , 700 * 1024 ) // 700KB transaction
@@ -540,7 +547,7 @@ func TestDARetriever_RetrieveForcedIncludedTxsFromDA_ExceedsMaxBlobSize(t *testi
540547 require .NoError (t , err )
541548
542549 d2 := & types.Data {
543- Metadata : & types.Metadata {ChainID : gen .ChainID , Height : 11 , Time : uint64 ( time . Now (). UnixNano ()) },
550+ Metadata : & types.Metadata {ChainID : gen .ChainID , Height : 11 , Time : fixedTime },
544551 Txs : make (types.Txs , 1 ),
545552 }
546553 d2 .Txs [0 ] = make ([]byte , 700 * 1024 ) // 700KB transaction
@@ -554,7 +561,7 @@ func TestDARetriever_RetrieveForcedIncludedTxsFromDA_ExceedsMaxBlobSize(t *testi
554561 require .NoError (t , err )
555562
556563 d3 := & types.Data {
557- Metadata : & types.Metadata {ChainID : gen .ChainID , Height : 12 , Time : uint64 ( time . Now (). UnixNano ()) },
564+ Metadata : & types.Metadata {ChainID : gen .ChainID , Height : 12 , Time : fixedTime },
558565 Txs : make (types.Txs , 1 ),
559566 }
560567 d3 .Txs [0 ] = make ([]byte , 700 * 1024 ) // 700KB transaction
@@ -720,10 +727,11 @@ func TestDARetriever_RetrieveForcedIncludedTxsFromDA_CompleteEpoch(t *testing.T)
720727 addr , pub , signer := buildSyncTestSigner (t )
721728 gen := genesis.Genesis {ChainID : "tchain" , InitialHeight : 1 , StartTime : time .Now ().Add (- time .Second ), ProposerAddress : addr , DAStartHeight : 2000 , DAEpochForcedInclusion : 3 }
722729
723- // Prepare forced inclusion transaction data
724- dataBin1 , _ := makeSignedDataBytes (t , gen .ChainID , 10 , addr , pub , signer , 2 )
725- dataBin2 , _ := makeSignedDataBytes (t , gen .ChainID , 11 , addr , pub , signer , 1 )
726- dataBin3 , _ := makeSignedDataBytes (t , gen .ChainID , 12 , addr , pub , signer , 1 )
730+ // Prepare forced inclusion transaction data with fixed timestamp
731+ fixedTime := uint64 (1234567890 )
732+ dataBin1 , _ := makeSignedDataBytesWithTime (t , gen .ChainID , 10 , addr , pub , signer , 2 , fixedTime )
733+ dataBin2 , _ := makeSignedDataBytesWithTime (t , gen .ChainID , 11 , addr , pub , signer , 1 , fixedTime )
734+ dataBin3 , _ := makeSignedDataBytesWithTime (t , gen .ChainID , 12 , addr , pub , signer , 1 , fixedTime )
727735
728736 cfg := config .DefaultConfig ()
729737 cfg .DA .ForcedInclusionNamespace = "nsForcedInclusion"
0 commit comments