Skip to content

Commit 58170e9

Browse files
committed
fix(events): order events consistently when querying
1 parent e84aa38 commit 58170e9

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
- Event APIs (Eth events and actor events) should only return reverted events if client queries by specific block hash / tipset. Eth and actor event subscription APIs should always return reverted events to enable accurate observation of real-time changes. ([filecoin-project/lotus#12585](https://github.com/filecoin-project/lotus/pull/12585))
1818
- Add logic to check if the miner's owner address is delegated (f4 address). If it is delegated, the `lotus-shed sectors termination-estimate` command now sends the termination state call using the worker ID. This fix resolves the issue where termination-estimate did not function correctly for miners with delegated owner addresses. ([filecoin-project/lotus#12569](https://github.com/filecoin-project/lotus/pull/12569))
1919
- Fix a bug in F3 participation API where valid leases may get removed due to dynamic manifest update. ([filecoin-project/lotus#12597](https://github.com/filecoin-project/lotus/pull/12597))
20-
2120
- Change the F3 participation ticket encoding to allow parity testing across non-go implementations, where a ticket issued by Lotus may need to be decoded by, for example, Forest . The changes also enforce the minimum instance participation of 1 for miners. ([filecoin-project/lotus#12615](https://github.com/filecoin-project/lotus/pull/12615))
21+
- 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))
2222

2323
## Deps
2424

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)