Skip to content

Commit

Permalink
slices, for loop copy, min/max update (#2006)
Browse files Browse the repository at this point in the history
* Update slices, for loop copy, min/max functions

* Revert append update

* Fix typo

* Fix linter

* Resolve merge conflict
  • Loading branch information
AnkushinDaniil committed Aug 12, 2024
1 parent 1dc2178 commit 2a1262d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"runtime"
"slices"
"sort"

"github.com/NethermindEth/juno/core/crypto"
"github.com/NethermindEth/juno/core/felt"
Expand Down Expand Up @@ -400,7 +401,7 @@ func (s *State) updateContractStorages(stateTrie *trie.Trie, diffs map[felt.Felt
for key := range diffs {
keys = append(keys, key)
}
slices.SortStableFunc(keys, func(a, b felt.Felt) int { return a.Cmp(&b) })
slices.SortStableFunc(keys, func(a, b felt.Felt) int { return len(diffs[a]) - len(diffs[b]) })

// update per-contract storage Tries concurrently
contractUpdaters := pool.NewWithResults[*bufferedTransactionWithAddress]().WithErrors().WithMaxGoroutines(runtime.GOMAXPROCS(0))
Expand Down

0 comments on commit 2a1262d

Please sign in to comment.