Skip to content

Commit 3a34832

Browse files
committed
fix(events): order events consistently when querying
1 parent 773efae commit 3a34832

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
- Upgrade go-f3 to 0.7.1 to resolve Tipset not found errors when trying to establish instance start time ([filecoin-project/lotus#12651](https://github.com/filecoin-project/lotus/pull/12651)).
2727
- Try harder in the F3 participation loop to participate using the same lotus node ([filecoin-project/lotus#12664](https://github.com/filecoin-project/lotus/pull/12664)).
2828
- The mining loop will now correctly "stick" to the same upstream lotus node for all operations pertaining to mining a single block ([filecoin-project/lotus#12665](https://github.com/filecoin-project/lotus/pull/12665)).
29+
- Make the ordering of event output for `eth_` APIs and `GetActorEventsRaw` consistent, sorting ascending on: epoch, message index, event index and original event entry order. ([filecoin-project/lotus#12623](https://github.com/filecoin-project/lotus/pull/12623))
2930

3031
## Deps
3132

chain/index/events.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"errors"
88
"fmt"
99
"math"
10-
"sort"
1110
"strings"
1211

1312
"github.com/ipfs/go-cid"
@@ -418,10 +417,6 @@ func (si *SqliteIndexer) GetEventsForFilter(ctx context.Context, f *EventFilter)
418417
return nil, nil
419418
}
420419

421-
// collected event list is in inverted order since we selected only the most recent events
422-
// sort it into height order
423-
sort.Slice(ces, func(i, j int) bool { return ces[i].Height < ces[j].Height })
424-
425420
return ces, nil
426421
}
427422

@@ -597,6 +592,6 @@ func makePrefillFilterQuery(f *EventFilter) ([]any, string, error) {
597592
}
598593

599594
// retain insertion order of event_entry rows
600-
s += " ORDER BY tm.height DESC, ee._rowid_ ASC"
595+
s += " ORDER BY tm.height ASC, tm.message_index ASC, e.event_index ASC, ee._rowid_ ASC"
601596
return values, s, nil
602597
}

0 commit comments

Comments
 (0)