File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package sync
2+
3+ import (
4+ "github.com/celestiaorg/go-libp2p-messenger/serde"
5+
6+ "github.com/evstack/ev-node/pkg/blobsize"
7+ )
8+
9+ func init () {
10+ // go-header wraps block data in another protobuf message, so leave room for
11+ // framing overhead beyond the maximum block payload.
12+ serde .MaxMessageSize = 2 * blobsize .DefaultMaxBlobSize
13+ }
Original file line number Diff line number Diff line change 1+ package sync
2+
3+ import (
4+ "encoding/binary"
5+ "testing"
6+
7+ p2ppb "github.com/celestiaorg/go-header/p2p/pb"
8+ "github.com/celestiaorg/go-libp2p-messenger/serde"
9+ "github.com/stretchr/testify/require"
10+
11+ "github.com/evstack/ev-node/pkg/blobsize"
12+ "github.com/evstack/ev-node/types"
13+ )
14+
15+ func TestP2PMessageSizeSupportsMaxBlob (t * testing.T ) {
16+ data := & types.P2PData {
17+ Data : & types.Data {
18+ Metadata : & types.Metadata {
19+ ChainID : "test-chain" ,
20+ Height : 1 ,
21+ Time : 1 ,
22+ },
23+ Txs : types.Txs {make ([]byte , int (blobsize .DefaultMaxBlobSize ))},
24+ },
25+ }
26+
27+ body , err := data .MarshalBinary ()
28+ require .NoError (t , err )
29+
30+ response := & p2ppb.HeaderResponse {Body : body }
31+ buf := make ([]byte , response .Size ()+ binary .MaxVarintLen64 )
32+ _ , err = serde .Marshal (response , buf )
33+ require .NoError (t , err )
34+ }
You can’t perform that action at this time.
0 commit comments