Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set log index across all transactions in a block #2067

Merged
merged 1 commit into from
Feb 10, 2025
Merged

Conversation

codchen
Copy link
Collaborator

@codchen codchen commented Feb 6, 2025

Describe your changes and provide context

Previously if we have two EVM transactions in the same block, each with 1 log, both logs will have log index of 0, because log index was set relative to each transaction. The expected behavior is for log index to be set across transactions in a block (i.e. the log of the first tx would have index 0, whereas the log of the second would have index 1).

It is not quite feasible to set log index as such during execution though, because transactions may be processed in parallel, so this PR adds backfill log on the read path instead.

Testing performed to validate your change

unit test

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.56%. Comparing base (9595df6) to head (630b24e).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2067      +/-   ##
==========================================
+ Coverage   61.54%   61.56%   +0.01%     
==========================================
  Files         264      264              
  Lines       24645    24647       +2     
==========================================
+ Hits        15168    15174       +6     
+ Misses       8347     8344       -3     
+ Partials     1130     1129       -1     
Files with missing lines Coverage Δ
app/receipt.go 86.63% <100.00%> (ø)
evmrpc/filter.go 75.49% <100.00%> (+0.16%) ⬆️
evmrpc/tx.go 68.16% <100.00%> (ø)
x/evm/keeper/log.go 45.76% <100.00%> (ø)

... and 1 file with indirect coverage changes

@codchen codchen merged commit 3a3af97 into main Feb 10, 2025
49 checks passed
@codchen codchen deleted the tony/fix-log-index branch February 10, 2025 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants