Skip to content

w3vm: fix txIndex during rollback#182

Merged
lmittmann merged 6 commits intolmittmann:mainfrom
wesraph:fix/tx-index-for-rollback
Aug 22, 2024
Merged

w3vm: fix txIndex during rollback#182
lmittmann merged 6 commits intolmittmann:mainfrom
wesraph:fix/tx-index-for-rollback

Conversation

@wesraph
Copy link
Copy Markdown
Contributor

@wesraph wesraph commented Aug 21, 2024

TxIndex is always set to 0 when a new vm is created while the snapshot index is different.

This bug can lead to getting the logs of the wrong tx after a simulation:

Steps to reproduce:

  • Get a block
  • Simulate tx[0]
  • Make a snapshot
  • Create a new vm and import a copy of the snapshot
  • Simulate tx[1]

The receipt will contain the logs of both 0 and 1. This fixes the bug by setting the vm's txIndex to the state's txIndex

@lmittmann lmittmann changed the title fix: import txIndex during rollback w3vm: fix txIndex during rollback Aug 22, 2024
@lmittmann lmittmann merged commit 54aeeda into lmittmann:main Aug 22, 2024
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.

2 participants