From cc2251e2842a698aad0d5fa435ba43532165ae2c Mon Sep 17 00:00:00 2001 From: vgonkivs Date: Mon, 24 Feb 2025 13:47:31 +0200 Subject: [PATCH 1/2] improvement(core): increase message size to 64Mb --- nodebuilder/core/constructors.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/nodebuilder/core/constructors.go b/nodebuilder/core/constructors.go index f5213c1283..f689530aee 100644 --- a/nodebuilder/core/constructors.go +++ b/nodebuilder/core/constructors.go @@ -22,10 +22,22 @@ import ( "github.com/celestiaorg/celestia-node/libs/utils" ) -const xtokenFileName = "xtoken.json" +const ( + // gRPC client requires fetching a block on initialization that can be larger + // than the default message size set in gRPC. Increasing defaults up to 64MB + // to avoid fixing it every time the block size increases. + // TODO(@vgonkivs): Revisit this constant once the block size reaches 64MB. + defaultGRPCMessageSize = 64 * 1024 * 1024 // 64Mb + xtokenFileName = "xtoken.json" +) func grpcClient(lc fx.Lifecycle, cfg Config) (*grpc.ClientConn, error) { - var opts []grpc.DialOption + opts := []grpc.DialOption{ + grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(defaultGRPCMessageSize), + grpc.MaxCallSendMsgSize(defaultGRPCMessageSize), + ), + } if cfg.TLSEnabled { opts = append(opts, grpc.WithTransportCredentials( credentials.NewTLS(&tls.Config{MinVersion: tls.VersionTLS12})), From 9c1c49dd726854796897861b0379fad30bf1d968 Mon Sep 17 00:00:00 2001 From: vgonkivs Date: Mon, 24 Feb 2025 14:50:05 +0200 Subject: [PATCH 2/2] udpate comment --- nodebuilder/core/constructors.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nodebuilder/core/constructors.go b/nodebuilder/core/constructors.go index f689530aee..b25963476f 100644 --- a/nodebuilder/core/constructors.go +++ b/nodebuilder/core/constructors.go @@ -26,6 +26,9 @@ const ( // gRPC client requires fetching a block on initialization that can be larger // than the default message size set in gRPC. Increasing defaults up to 64MB // to avoid fixing it every time the block size increases. + // Tested on mainnet node: + // square size = 128 + // actual response size = 10,85mb // TODO(@vgonkivs): Revisit this constant once the block size reaches 64MB. defaultGRPCMessageSize = 64 * 1024 * 1024 // 64Mb xtokenFileName = "xtoken.json"