-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
(#2) Alloy Migration: Migrate non-cheatcode inspectors #5770
Conversation
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..]); |
There was a problem hiding this comment.
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())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, definitely more elegant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in a1fe075
There was a problem hiding this comment.
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
274c2ea
to
6e4b0bf
Compare
@@ -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()); |
There was a problem hiding this comment.
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>
19443b0
to
10899ee
Compare
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..]); |
There was a problem hiding this comment.
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
aight, my bad! this should be it with 12d2de9 |
As soon as we merge i'll resolve comments on #5768 |
* 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
Motivation
Migrates the whole inspector stack to use alloy types. Composite types like
trace
-related types will be migrated later..