Skip to content

Fix events collection#675

Merged
anishnaik merged 2 commits intomasterfrom
fix-events-collection
Aug 22, 2025
Merged

Fix events collection#675
anishnaik merged 2 commits intomasterfrom
fix-events-collection

Conversation

@elopez
Copy link
Copy Markdown
Member

@elopez elopez commented Aug 22, 2025

GetLogs() walks the map[common.Hash][]*types.Log and concatenates all of the events there. Then it picks the last one. However, the current tx hash is not necessarily the last one on the concatenation, which means that the event collected is probably not the desired one.

This changes the code to store the current tx hash OnTxStart and then use it to query the specific logs for that transaction.

Additionally, the transaction object doesn't have the "from" address as that is implied by the signature on a normal transaction. However, medusa does not sign transactions, which causes transaction hashes to collision if they only differ in the sender address. To keep them distinguishable from each other, this stores the from address in one of the signature fields.

elopez added 2 commits August 22, 2025 01:14
GetLogs() walks the `map[common.Hash][]*types.Log` and concatenates
all of the events there. Then it picks the last one. However, the
current tx hash is not necessarily the last one on the concatenation,
which means that the event collected is probably not the desired one.

This changes the code to store the current tx hash OnTxStart and then
use it to query the specific logs for that transaction.
The transaction object doesn't have the "from" address as that is
implied by the signature on a normal transaction. However, medusa
does not sign transactions. To keep them distinguishable from each
other, this stores the from address in one of the signature fields.
@elopez elopez linked an issue Aug 22, 2025 that may be closed by this pull request
@anishnaik anishnaik marked this pull request as ready for review August 22, 2025 14:15
@anishnaik anishnaik merged commit af1d498 into master Aug 22, 2025
12 checks passed
@anishnaik anishnaik deleted the fix-events-collection branch August 22, 2025 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Events get logged out of order and/or with wrong values

2 participants