Skip to content

feat: improve UsedStateEVMInspector by adding more op-codes - #161

Merged
dvush merged 3 commits into
flashbots:developfrom
nikoseven:dev_inspector_more_fields
Sep 20, 2024
Merged

feat: improve UsedStateEVMInspector by adding more op-codes#161
dvush merged 3 commits into
flashbots:developfrom
nikoseven:dev_inspector_more_fields

Conversation

@nikoseven

@nikoseven nikoseven commented Aug 28, 2024

Copy link
Copy Markdown
Contributor

📝 Summary

Added support for SELFBALANCE, BALANCE, CALL, CREATE, and SELFDESTRUCT op-codes in UsedStateEVMInspector.
New test cases for evm inspector have been added.

💡 Motivation and Context

Related discussion in #58.
For opcodes like EXTCODECOPY, EXTCODEHASH, and EXTCODESIZE, I thought we could add them in the future with a concrete use case, so that we can properly design the datastruct for it.


✅ I have completed the following steps:

  • Run make lint
  • Run make test
  • Added tests (if applicable)

@nikoseven nikoseven changed the title Add more fields in evm inspector: read_balances, received_amount, sen… [feat] improve UsedStateEVMInspector by adding more op-codes Aug 28, 2024
@nikoseven nikoseven changed the title [feat] improve UsedStateEVMInspector by adding more op-codes feat: improve UsedStateEVMInspector by adding more op-codes Aug 28, 2024
@dvush

dvush commented Sep 3, 2024

Copy link
Copy Markdown
Contributor

@nikoseven nice, thank you. I'll look into it soon.

@ZanCorDX

ZanCorDX commented Sep 4, 2024

Copy link
Copy Markdown
Collaborator

Hi!
We are considering adding some benchmarks before adding some extra weight to the execution code.
In the meantime, I see the word "Ephernal", did you mean "Ephemeral"?

@nikoseven

nikoseven commented Sep 5, 2024

Copy link
Copy Markdown
Contributor Author

Hi! We are considering adding some benchmarks before adding some extra weight to the execution code. In the meantime, I see the word "Ephernal", did you mean "Ephemeral"?

Fixed the typo. Thanks!
I'll wait for updates after benchmark being added.

@github-actions

github-actions Bot commented Sep 9, 2024

Copy link
Copy Markdown

Benchmark results for 3e21dd2

Report: https://flashbots-rbuilder-ci-stats.s3.us-east-2.amazonaws.com/benchmark/3e21dd2-a00be29/report/index.html

Date (UTC) 2024-09-14T20:14:26+00:00
Commit 3e21dd2c7d9a828985e67641107cedefd9f50eb8
Base SHA a00be29a28181baff42058fd1b1146a825566d2c

Significant changes

Benchmark Mean Status
MEV-Boost SubmitBlock serialization/JSON encoding 46.88% Performance has degraded.

@dvush dvush left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any issue. It looks great. One thing though, we updated reth and revm so can you please rebase.

re additonal allocations / performance: I don't think that this changes the pictrure in any way

  1. we were already instrumenting step
  2. this adds call/call_end instrumentation that runs very rarely
  3. we were already allocating hashmap for each slot and here it allocates a tiny bit of data that is much smaller than that (the order is just the number of internal calls)

@nikoseven
nikoseven force-pushed the dev_inspector_more_fields branch from e83992c to 3e21dd2 Compare September 13, 2024 16:19
@dvush
dvush self-requested a review September 13, 2024 16:56

@dvush dvush left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a small issue that would make balance part of the trace incorrect. I don't think that it must be fixed for this to be merged because our slot logic was not handling reverts anyway.

}

fn selfdestruct(&mut self, contract: Address, target: Address, value: U256) {
self.used_state_trace.destructed_contracts.push(contract);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should check if contract was already destroyed and return if yes. Selfdestruct can be called multiple times in one tx.

if let Some(transfer_value) = inputs.transfer_value() {
if !transfer_value.is_zero() {
*self
.used_state_trace

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be incorrect if call fails.

@dvush
dvush merged commit 20b4f93 into flashbots:develop Sep 20, 2024
dvush added a commit that referenced this pull request Sep 21, 2024
astarinmymind pushed a commit that referenced this pull request Oct 3, 2024
## 📝 Summary
Added support for SELFBALANCE, BALANCE, CALL, CREATE, and SELFDESTRUCT
op-codes in UsedStateEVMInspector.
New test cases for evm inspector have been added.

## 💡 Motivation and Context
Related discussion in #58.
For opcodes like EXTCODECOPY, EXTCODEHASH, and EXTCODESIZE, I thought we
could add them in the future with a concrete use case, so that we can
properly design the datastruct for it.

---

## ✅ I have completed the following steps:

* [x] Run `make lint`
* [x] Run `make test`
* [x] Added tests (if applicable)
astarinmymind pushed a commit that referenced this pull request Oct 3, 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.

3 participants