From b1bc42b86815ca781eabc647f6e98e2c7cc90a3b Mon Sep 17 00:00:00 2001 From: Matthias Fasching <5011972+fasmat@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:52:10 +0000 Subject: [PATCH] Fix response data slice too small (#6248) ## Motivation The response msg object needs to be increased in size to allow 8.0 Mio ATXs to be processed by the node --- fetch/wire_types.go | 3 ++- p2p/server/server.go | 2 +- p2p/server/server_scale.go | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fetch/wire_types.go b/fetch/wire_types.go index 725b6af6130..5ac39fb23bd 100644 --- a/fetch/wire_types.go +++ b/fetch/wire_types.go @@ -121,7 +121,8 @@ type MaliciousIDs struct { type EpochData struct { // When changing this value also check - // - the size of `ResponseMessage` above + // - the size of `ResponseMessage.Data` above + // - the size of `Response.Data` in `p2p/server/server.go` // - the size of `NodeIDs` in `MaliciousIDs` above // - the size of `Set` in `EpochActiveSet` in common/types/activation.go // - the size of `EligibilityProofs` in the type `Ballot` in common/types/ballot.go diff --git a/p2p/server/server.go b/p2p/server/server.go index a1ead5c8d97..e64c7ce9251 100644 --- a/p2p/server/server.go +++ b/p2p/server/server.go @@ -139,7 +139,7 @@ func (err *ServerError) Error() string { // Response is a server response. type Response struct { // keep in line with limit of ResponseMessage.Data in `fetch/wire_types.go` - Data []byte `scale:"max=209715200"` // 200 MiB > 6.0 mio ATX * 32 bytes per ID + Data []byte `scale:"max=272629760"` // 260 MiB > 8.0 mio ATX * 32 bytes per ID Error string `scale:"max=1024"` // TODO(mafa): make error code instead of string } diff --git a/p2p/server/server_scale.go b/p2p/server/server_scale.go index 03cce911d59..a66d6694145 100644 --- a/p2p/server/server_scale.go +++ b/p2p/server/server_scale.go @@ -9,7 +9,7 @@ import ( func (t *Response) EncodeScale(enc *scale.Encoder) (total int, err error) { { - n, err := scale.EncodeByteSliceWithLimit(enc, t.Data, 209715200) + n, err := scale.EncodeByteSliceWithLimit(enc, t.Data, 272629760) if err != nil { return total, err } @@ -27,7 +27,7 @@ func (t *Response) EncodeScale(enc *scale.Encoder) (total int, err error) { func (t *Response) DecodeScale(dec *scale.Decoder) (total int, err error) { { - field, n, err := scale.DecodeByteSliceWithLimit(dec, 209715200) + field, n, err := scale.DecodeByteSliceWithLimit(dec, 272629760) if err != nil { return total, err }