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

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

Merged
merged 3 commits into from
Sep 20, 2024

Conversation

nikoseven
Copy link
Contributor

@nikoseven nikoseven commented Aug 28, 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:

  • 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
Copy link
Contributor

dvush commented Sep 3, 2024

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

@ZanCorDX
Copy link
Contributor

ZanCorDX commented Sep 4, 2024

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
Copy link
Contributor Author

nikoseven commented Sep 5, 2024

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.

Copy link

github-actions bot commented Sep 9, 2024

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.

Copy link
Contributor

@dvush dvush left a comment

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)

Copy link
Contributor

@dvush dvush left a comment

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
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
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
3 checks passed
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