From da10d43afac7c8c6fdfa2015da0282008b041768 Mon Sep 17 00:00:00 2001 From: Matthias Fasching <5011972+fasmat@users.noreply.github.com> Date: Tue, 13 Aug 2024 10:51:16 +0200 Subject: [PATCH] Backport 6248: Fix response data slice too small (#6249) --- CHANGELOG.md | 7 +++++++ fetch/wire_types.go | 3 ++- p2p/server/server.go | 2 +- p2p/server/server_scale.go | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08b3b0099c..bccb05ac57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ See [RELEASE](./RELEASE.md) for workflow instructions. +## Release v1.6.6-hotfix1 + +### Improvements + +* [#6248](https://github.com/spacemeshos/go-spacemesh/pull/6248) Fixed node not being able to handle more than 6.55M + ATXs per epoch. + ## Release v1.6.6 ### Improvements diff --git a/fetch/wire_types.go b/fetch/wire_types.go index 725b6af613..5ac39fb23b 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 51a3a84168..f87093b74b 100644 --- a/p2p/server/server.go +++ b/p2p/server/server.go @@ -138,7 +138,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 03cce911d5..a66d669414 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 }