From ea7061e31112a531921fba6dadf5931c674ff850 Mon Sep 17 00:00:00 2001 From: Georgi Date: Thu, 19 Dec 2024 11:11:59 +0200 Subject: [PATCH] fix(native): ensure buckets use valid references --- fhevm-engine/fhevm-go-native/fhevm/api.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fhevm-engine/fhevm-go-native/fhevm/api.go b/fhevm-engine/fhevm-go-native/fhevm/api.go index 1157953..76f18e7 100644 --- a/fhevm-engine/fhevm-go-native/fhevm/api.go +++ b/fhevm-engine/fhevm-go-native/fhevm/api.go @@ -576,12 +576,13 @@ func (dbApi *EvmStorageComputationStore) InsertComputationBatch(evmStorage Chain // his ciphertexts to be evaluated buckets := make(map[int64][]*ComputationToInsert) // index the buckets - for _, comp := range computations { + for ind, comp := range computations { if buckets[comp.CommitBlockId] == nil { buckets[comp.CommitBlockId] = make([]*ComputationToInsert, 0) } - buckets[comp.CommitBlockId] = append(buckets[comp.CommitBlockId], &comp) + buckets[comp.CommitBlockId] = append(buckets[comp.CommitBlockId], &computations[ind]) } + // collect all their keys and sort because golang doesn't traverse map // in deterministic order allKeys := make([]int, 0)