-
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
Upgrade to latest version of Alloy and port Anvil tests #7701
Conversation
…ce_transaction`, `can_reject_too_high_gas_limits`, `can_reject_underpriced_replacement`
…nspect methods on the provider, see alloy-rs/alloy#502
…cted in relation to impersonation
…_manually` tx tests migrated to alloy
…toric` tx tests to alloy
…e_nonce & can_handle_multiple_concurrent_transactions_with_same_nonce tx tests
…ds some more investigation
@yash-atreya I've marked this as ready for review now that all tests are running (w/ exception of a few ignored tests, document reasons). I think it is best if the final migration of |
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,
a few more nits and suggestions
let's convert all for those
http_provider(&handle.http_endpoint());
to handle.http_provider()
same for ws and ipc
crates/anvil/tests/it/ipc.rs
Outdated
// TODO: throws: `Transport(Custom(Os { code: 2, kind: NotFound, message: "The system cannot find | ||
// the file specified." }))` on Windows |
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.
for this,
maybe the issue is here:
foundry/crates/common/src/provider/mod.rs
Lines 116 to 117 in 61bec81
if let Ok(path) = resolve_path(path) { | |
Url::parse(&format!("file://{}", path.display())) |
I don't think this will work for windows
I assume this ends up here:
foundry/crates/common/src/provider/runtime_transport.rs
Lines 199 to 200 in 61bec81
let ipc = | |
ipc_connector.into_service().await.map_err(RuntimeTransportError::TransportError)?; |
can we include the path in the error message here and check which path gets used here
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.
Got this error:
Transport(Custom(TransportErrorTest(Transport(Custom(Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." })), "file:///pipe/anvil-ipc-7861286456766970431", "\\\\.\\pipe\\anvil-ipc-7861286456766970431")))
The conversion appears to be correct (format: error, url, path), expected format is: \\.\pipe\reth_engine_api.ipc
after escaping.
Attempted to replace it with the approach defined in this test in Alloy by using a tempfile: https://github.com/alloy-rs/alloy/blob/4d77029ba61284a6b4185f46581b4d9bce34f5fd/crates/rpc-client/tests/it/ipc.rs#L5
I noticed that Alloy currently only runs CI tests against latest Ubuntu making it likely that this is an area of the codebase not fully tested yet.
Going to hop onto my Windows machine and see if I can debug it there.
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.
I've been getting conflicting reports
I was able to replicate it locally on my Windows machine with the Alloy repo but that could be related to other issues
But when running Alloy on Windows targets in the CI it does not throw: https://github.com/zerosnacks/alloy/actions/runs/8848697130
I think it is most likely it is indeed related to some sort of formatting or handling on Foundry's side
let path = Path::new(url_str); | ||
|
||
if let Ok(path) = resolve_path(path) { | ||
Url::parse(&format!("file://{}", path.display())) |
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 could be an issue for the windows ipc
…pool_transactions
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.
I'm okay with disabling ipc tests on windows for now, and fix separately on alloy or in a follow up once we found it
but i really want more context (the path) included in this error, because this is useless:
thread 'ipc::can_get_block_number_ipc' panicked at crates\anvil\tests\it\ipc.rs:31:49:
calledResult::unwrap()
on anErr
value: Transport(Custom(TransportError(Transport(Custom(Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." })))))
this needs to happen in alloy though, do we know where this is thrown?
I agree, lets not make this a blocker and handle this in a follow up. I've added some extra information to the Some places I found suspicious: casting to foundry/crates/anvil/src/lib.rs Line 324 in d21c3e7
Tests for the existence of the file, not something we do in the current test. However when I changed it to use Alloy's And as previously highlighted foundry/crates/common/src/provider/mod.rs Lines 113 to 117 in 5f801b4
|
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.
gg
let's add a windows target to alloy CI and ensure IPC works cross platform
Opened a draft PR here: alloy-rs/alloy#642 I previously made a mistake when I was testing it earlier against the CI (mistakingly had set |
Motivation
Builds on top of #7619
Closes #7449
Solution
Upgrades Foundry to latest version of Alloy
Updates the following examples to use Alloy
Breaking changes:
Polygon
andPolygon Mumbai
EIP-1559 fees handling of GasOracle middlewareNotes:
The final migration of
cast bind
andforge bind
is planned to be handled in a standalone ticket given its possible complexity and the diff has already grown massivelyGiven that the port of Alloy has largely already occurred the odd cases of failing tests are largely descriptive of current issues (and flagged as such), not new issues introduced by this ticket.
Few tests have been migrated but fail due to issues:
[Bug]watch_pending_transaction
hangs for non-pending transactions alloy-rs/alloy#389Tests failing due totest_fork_snapshotting_blocks
,test_fork_timestamp
,test_fork_reset_moonbeam
,can_call_ots_get_transaction_error
,can_replace_transaction
.RpcError in
watch_full_pending_transactions
3. Test failing:can_stream_pending_transactions
: Pubsubchannel_size
issue intest_sub_new_heads_fast
.4. Optimism
test_deposits_not_supported_if_optimism_disabled
, likely the other Optimism tests aren't working as expected5. Test failing:
can_get_block_number_ipc
andtest_sub_new_heads_ipc
fail on Windows