Skip to content

Commit 97f416b

Browse files
authored
dataColumnSidecarByRootRPCHandler: Do not rely any more on map iteration, which does not produce reproducible output order. (#15441)
1 parent 1c1e0f3 commit 97f416b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

beacon-chain/sync/rpc_data_column_sidecars_by_root.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
fieldparams "github.com/OffchainLabs/prysm/v6/config/fieldparams"
1313
"github.com/OffchainLabs/prysm/v6/config/params"
1414
"github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
15+
"github.com/OffchainLabs/prysm/v6/encoding/bytesutil"
1516
"github.com/OffchainLabs/prysm/v6/monitoring/tracing"
1617
"github.com/OffchainLabs/prysm/v6/monitoring/tracing/trace"
1718
"github.com/OffchainLabs/prysm/v6/time/slots"
@@ -98,12 +99,15 @@ func (s *Service) dataColumnSidecarByRootRPCHandler(ctx context.Context, msg int
9899
log.Debug("Serving data column sidecar by root request")
99100

100101
count := 0
101-
for root, columns := range requestedColumnsByRoot {
102+
for _, ident := range requestedColumnIdents {
102103
if err := ctx.Err(); err != nil {
103104
closeStream(stream, log)
104105
return errors.Wrap(err, "context error")
105106
}
106107

108+
root := bytesutil.ToBytes32(ident.BlockRoot)
109+
columns := ident.Columns
110+
107111
// Throttle request processing to no more than batchSize/sec.
108112
for range columns {
109113
if ticker != nil && count != 0 && count%batchSize == 0 {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
### Fixed
2+
- Non deterministic output order of `dataColumnSidecarByRootRPCHandler`.

0 commit comments

Comments
 (0)