-
Notifications
You must be signed in to change notification settings - Fork 85
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
L1 client: ethers
-> alloy
#2456
base: main
Are you sure you want to change the base?
Conversation
forge bind --contracts ./contracts/src/ --ethers --crate-name contract-bindings-ethers --bindings-path contract-bindings-ethers --select "{{REGEXP}}" --overwrite --force | ||
|
||
# Generate the alloy bindings | ||
# For now, to compile these, you need to fork `alloy-core` and change the `RESOLVE_LIMIT`. From there, you need to |
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.
@rob-maron have we opened and issue or PR to get this change into alloy-core?
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.
What's the value of RESOLVE_LIMIT we need? Probably quickest if we open a PR bumping it to the value we need and mention why we need the increase.
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.
Right now I have RESOLVE_LIMIT
set to 128 (from 32). Thanks for noting, I will add it to the comments for now
I will also open an issue/PR shortly - want to see why this is failing tests first
#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, Hash, PartialEq, Eq)] | ||
pub struct L1BlockInfo { | ||
pub number: u64, | ||
pub timestamp: U256, | ||
pub hash: H256, | ||
pub timestamp: ethers::types::U256, | ||
pub hash: ethers::types::H256, |
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.
Need to keep these as ethers
types because if not it breaks header serialization
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.
It's weird these types deserialize differently with alloy
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.
Yeah. When I get to switching everything else I'll see if it could just be some endianness thing. It didn't immediately allow me to choose le
or be
when I had tried to fix this
…spresso-sequencer into rm/ethers-rpc-to-alloy
pub async fn is_proxy_contract(&self, proxy_address: Address) -> anyhow::Result<bool> { | ||
// confirm that the proxy_address is a proxy | ||
// using the implementation slot, 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc, which is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1 | ||
let hex_bytes = | ||
hex::decode("360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc") | ||
.expect("Failed to decode hex string"); | ||
let implementation_slot = B256::from_slice(&hex_bytes); | ||
let storage = self | ||
.provider | ||
.get_storage_at(proxy_address, implementation_slot.into()) | ||
.await?; | ||
|
||
let implementation_address = Address::from_slice(&storage.to_be_bytes::<32>()[12..]); | ||
|
||
// when the implementation address is not equal to zero, it's a proxy | ||
Ok(implementation_address != Address::ZERO) |
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.
This function was duplicated - we need one written for ethers
for the contract deployer but we also need one here
This PR:
This PR does not:
Files to pay attention to:
Both
l1.rs
s comprise the majority of the real changes in this PR