diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a99323c9e..b04d1ea09e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `transaction.hash()` is no longer a function, it is now a property that returns the hash of the transaction. - Improved efficiency of computing `AccountUpdate.callData` by packing field elements into as few field elements as possible https://github.com/o1-labs/o1js/pull/1458 - This leads to a large reduction in the number of constraints used when inputs to a zkApp method are many field elements (e.g. a long list of `Bool`s) +- Return events in the `LocalBlockchain` in reverse chronological order (latest events at the beginning) to match the behavior of the `Network` https://github.com/o1-labs/o1js/pull/1460 ### Added diff --git a/src/lib/mina/local-blockchain.ts b/src/lib/mina/local-blockchain.ts index 06dbf66911..852abf34ae 100644 --- a/src/lib/mina/local-blockchain.ts +++ b/src/lib/mina/local-blockchain.ts @@ -326,7 +326,11 @@ function LocalBlockchain({ ); }, async fetchEvents(publicKey: PublicKey, tokenId: Field = TokenId.default) { - return events?.[publicKey.toBase58()]?.[TokenId.toBase58(tokenId)] ?? []; + // Return events in reverse chronological order (latest events at the beginning) + const reversedEvents = ( + events?.[publicKey.toBase58()]?.[TokenId.toBase58(tokenId)] ?? [] + ).reverse(); + return reversedEvents; }, async fetchActions( publicKey: PublicKey,