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

(#2) Alloy Migration: Migrate non-cheatcode inspectors #5770

Merged
merged 15 commits into from Sep 15, 2023

Conversation

Evalir
Copy link
Member

@Evalir Evalir commented Aug 31, 2023

Motivation

Migrates the whole inspector stack to use alloy types. Composite types like trace-related types will be migrated later..

@Evalir Evalir marked this pull request as ready for review September 14, 2023 06:37
@Evalir Evalir changed the title feat: migrate non-cheatcode inspectors (#2) Alloy Migration: Migrate non-cheatcode inspectors Sep 14, 2023
crates/debugger/src/debugger.rs Show resolved Hide resolved
if !self.excluded.contains(&addr) {
self.access_list.entry(addr).or_default();
}
}
}
opcode::DELEGATECALL | opcode::CALL | opcode::STATICCALL | opcode::CALLCODE => {
if let Ok(slot) = interpreter.stack().peek(1) {
let addr: Address = H256::from_uint(&ru256_to_u256(slot)).into();
let addr: Address = Address::from_slice(&slot.to_be_bytes::<32>()[12..]);
Copy link
Member

Choose a reason for hiding this comment

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

Probably better as Address::from_word(slot.into())

Copy link
Member Author

Choose a reason for hiding this comment

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

nice, definitely more elegant

Copy link
Member Author

Choose a reason for hiding this comment

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

done in a1fe075

Copy link
Member

Choose a reason for hiding this comment

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

missing this line, you changed only the one above

@Evalir Evalir force-pushed the evalir/migrate-executor-folder branch from 274c2ea to 6e4b0bf Compare September 15, 2023 14:08
@@ -68,7 +69,7 @@ impl<DB: Database> Inspector<DB> for AccessListTracer {
opcode::BALANCE |
opcode::SELFDESTRUCT => {
if let Ok(slot) = interpreter.stack().peek(0) {
let addr: Address = Address::from_slice(&slot.to_be_bytes::<32>()[12..]);
let addr: Address = Address::from_word(slot.to_be_bytes::<32>().into());
Copy link
Member

Choose a reason for hiding this comment

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

Can also drop to_be_bytes because of U256: From<B256>

@Evalir Evalir force-pushed the evalir/migrate-executor-folder branch from 19443b0 to 10899ee Compare September 15, 2023 14:48
if !self.excluded.contains(&addr) {
self.access_list.entry(addr).or_default();
}
}
}
opcode::DELEGATECALL | opcode::CALL | opcode::STATICCALL | opcode::CALLCODE => {
if let Ok(slot) = interpreter.stack().peek(1) {
let addr: Address = H256::from_uint(&ru256_to_u256(slot)).into();
let addr: Address = Address::from_slice(&slot.to_be_bytes::<32>()[12..]);
Copy link
Member

Choose a reason for hiding this comment

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

missing this line, you changed only the one above

@Evalir
Copy link
Member Author

Evalir commented Sep 15, 2023

aight, my bad! this should be it with 12d2de9

@Evalir
Copy link
Member Author

Evalir commented Sep 15, 2023

As soon as we merge i'll resolve comments on #5768

@Evalir Evalir merged commit ce4984f into evalir/make-executor-alloy Sep 15, 2023
16 checks passed
@Evalir Evalir deleted the evalir/migrate-executor-folder branch September 15, 2023 15:45
Evalir added a commit that referenced this pull request Sep 18, 2023
* feat: use alloy revm branch

* fuzz/mod migrated

* progress

* progress, fmt

* fix imdb

* feat: cheatcodes compile

* feat: fork backend compiles

* feat: trace

* fuzz

* anvil progress

* chore: mem, fmt

* chore: db.rs

* chore: it lives

* fix test

* chore: clippy

* workin

* main backend stuff migrated

* chore: add glue on other crates

* chore: make executor use alloy types

* add glue for executor migration

* chore: use workspace alloy

* chore: undo revm bump changes

* chore: remove unneded prefix

* chore: fix fork fixture

* chore: uncomment tests

* chore: switch to up-to-date revm

* chore: clippy

* (#2) Alloy Migration: Migrate non-cheatcode inspectors (#5770)

* feat: migrate non-cheatcode inspectors

* fix: properly create both create and create2 addresses

* chore: clippy

* (#3) Alloy Migration: migrate fork-adjacent files to alloy primitives (#5771)

* chore: use create2_from_code

* borrow it brah

* chore: use from word

* chore: drop to_be_bytes

* fmt

* chore: use from_word on both palces

* chore: use address::random

* chore: make failure slot b256

* chore: use address::random

* chore: fix indexes

* chore: use contract.hash

* chore: do not collect

* chore: use display on alloy nums

* use + operator

* chore: unwrap bytes and replace import

* chore: Into:: -> ::from

* chore: fix test

* chore: use alloy imports

* chore: switch to alloy typesd

* chore: fix test
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.

None yet

2 participants