From 3dfcb87e84a1b2d6731f7d1fc19a5f052e93d16f Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Tue, 22 Oct 2024 16:37:03 +1100 Subject: [PATCH] fix(events): order events consistently when querying --- CHANGELOG.md | 2 +- chain/index/events.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7062777816..9c0e8e76e0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,8 +17,8 @@ - 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)) - 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)) - 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)) - - 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)) +- 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)) ## Deps diff --git a/chain/index/events.go b/chain/index/events.go index 0a1836f7b96..d09e56159fc 100644 --- a/chain/index/events.go +++ b/chain/index/events.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "math" - "sort" "strings" "github.com/ipfs/go-cid" @@ -420,7 +419,7 @@ func (si *SqliteIndexer) GetEventsForFilter(ctx context.Context, f *EventFilter) // collected event list is in inverted order since we selected only the most recent events // sort it into height order - sort.Slice(ces, func(i, j int) bool { return ces[i].Height < ces[j].Height }) + // sort.Slice(ces, func(i, j int) bool { return ces[i].Height < ces[j].Height }) return ces, nil } @@ -597,6 +596,6 @@ func makePrefillFilterQuery(f *EventFilter) ([]any, string, error) { } // retain insertion order of event_entry rows - s += " ORDER BY tm.height DESC, ee._rowid_ ASC" + s += " ORDER BY tm.height ASC, tm.message_index ASC, e.event_index ASC, ee._rowid_ ASC" return values, s, nil }