From 838aacf51d8738ed7eda20047569a0b7095d07d0 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Fri, 1 Mar 2024 16:52:21 -0600 Subject: [PATCH] Fix recording blob preimages --- staker/stateless_block_validator.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/staker/stateless_block_validator.go b/staker/stateless_block_validator.go index 6fdddd3390..fcd1f247c2 100644 --- a/staker/stateless_block_validator.go +++ b/staker/stateless_block_validator.go @@ -310,7 +310,10 @@ func (v *StatelessBlockValidator) ValidationEntryRecord(ctx context.Context, e * e.Preimages[arbutil.EthVersionedHashPreimageType] = make(map[common.Hash][]byte) } for i, blob := range blobs { - e.Preimages[arbutil.EthVersionedHashPreimageType][versionedHashes[i]] = blob[:] + // Prevent aliasing `blob` when slicing it, as for range loops overwrite the same variable + // Won't be necessary after Go 1.22 with https://go.dev/blog/loopvar-preview + b := blob + e.Preimages[arbutil.EthVersionedHashPreimageType][versionedHashes[i]] = b[:] } } if arbstate.IsDASMessageHeaderByte(batch.Data[40]) {