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

Anvil tests alloy migration #7619

Conversation

yash-atreya
Copy link
Member

Motivation

Remove the last bit of ethers dependency.

Solution

WIP

Replace with alloy.

Comment on lines +31 to +69
pub fn http_provider(http_endpoint: &str) -> AlloyRetryProvider {
get_http_provider(http_endpoint)
}

pub fn http_provider_with_signer(
http_endpoint: &str,
signer: EthereumSigner,
) -> RetryProviderWithSigner {
AlloyProviderBuilder::new(http_endpoint)
.build_with_signer(signer)
.expect("failed to build Alloy HTTP provider with signer")
}

pub fn ws_provider(ws_endpoint: &str) -> AlloyRetryProvider {
AlloyProviderBuilder::new(ws_endpoint).build().expect("failed to build Alloy WS provider")
}

pub fn ws_provider_with_signer(
ws_endpoint: &str,
signer: EthereumSigner,
) -> RetryProviderWithSigner {
AlloyProviderBuilder::new(ws_endpoint)
.build_with_signer(signer)
.expect("failed to build Alloy WS provider with signer")
}

pub async fn ipc_provider(ipc_endpoint: &str) -> AlloyRetryProvider {
AlloyProviderBuilder::new(ipc_endpoint).build().expect("failed to build Alloy IPC provider")
}

pub async fn ipc_provider_with_signer(
ipc_endpoint: &str,
signer: EthereumSigner,
) -> RetryProviderWithSigner {
AlloyProviderBuilder::new(ipc_endpoint)
.build_with_signer(signer)
.expect("failed to build Alloy IPC provider with signer")
}

Copy link
Member

Choose a reason for hiding this comment

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

We probably will want to include the recommended layers in try_get_http_provider at some point

@yash-atreya
Copy link
Member Author

@mattsse transaction tests have been migrated to alloy with some TODOs awaiting alloy-rs/alloy#389 to be solved.

Facing an issue with watch_full_pending_transactions in the can_stream_pending_transactions test. Would like some help here.

error: ErrorPayload { code: -32602, message: "invalid type: boolean `true`, expected
// unit", data: None }

I'll take traces now; that's the next big one, and pubsub after that. cc @zerosnacks

@zerosnacks zerosnacks changed the base branch from master to zerosnacks/port-anvil-to-alloy April 16, 2024 14:41
mattsse pushed a commit to paradigmxyz/revm-inspectors that referenced this pull request Apr 17, 2024
## Motivation

Alloy deps need to be bumped in
foundry-rs/foundry#7619. This creates a
conflicting deps version between `evm-inspectors` and `foundry` for
`alloy-rpc-types` and `alloy-rpc-types-trace`

## Solution

Bump to latest alloy commit
@@ -202,11 +202,11 @@ where
fn get_account_req(&self, address: Address) -> ProviderRequest<eyre::Report> {
trace!(target: "backendhandler", "preparing account request, address={:?}", address);
let provider = self.provider.clone();
let block_id = self.block_id;
let block_id = self.block_id.unwrap_or(BlockId::latest());
Copy link
Member

@zerosnacks zerosnacks Apr 17, 2024

Choose a reason for hiding this comment

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

I think you could use unwrap_or_default() here as it will use BlockId::latest() by default, same goes for the other instances

Cargo.toml Outdated Show resolved Hide resolved
@zerosnacks zerosnacks merged commit a88d57b into foundry-rs:zerosnacks/port-anvil-to-alloy Apr 18, 2024
@zerosnacks
Copy link
Member

Superceded by #7701 to collaborate easier

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.

2 participants