From a9db265d4e06ca87db3b5826f029fcbd48aff758 Mon Sep 17 00:00:00 2001 From: wit liu <765765346@qq.com> Date: Fri, 14 Nov 2025 22:37:32 +0800 Subject: [PATCH] core/state: fix bug about getting stable LogsHash result #33082 (#1768) --- core/state/statedb.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/state/statedb.go b/core/state/statedb.go index 3f55b8fb27..809a3a31b7 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -21,6 +21,7 @@ import ( "fmt" "maps" "math/big" + "slices" "sort" "time" @@ -205,6 +206,9 @@ func (s *StateDB) Logs() []*types.Log { for _, lgs := range s.logs { logs = append(logs, lgs...) } + slices.SortFunc(logs, func(a, b *types.Log) int { + return int(a.Index) - int(b.Index) + }) return logs }