-
Notifications
You must be signed in to change notification settings - Fork 795
Conversation
Not sure what the test failure is, will take a look today. Seems to pass when run with |
Seems this is the issue: ethers-rs/ethers-providers/src/provider.rs Lines 1170 to 1171 in 24f9bd0
Also, this is jammed into provider.rs because it needs access to the request. If making that |
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 work! Will merge once linted, if you want to do it @wolflo, otherwise i'll try later
ethers-providers/src/provider.rs
Outdated
match ok { | ||
true => Ok(()), | ||
false => Err(DevRpcMiddlewareError::NoSnapshotError), | ||
} |
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.
an if {} else {}
would be more idiomatic here
ProviderError(ProviderError), | ||
|
||
#[error("Could not revert to snapshot")] | ||
NoSnapshot, |
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.
Maybe I misunderstood this lint, but it seems to not jive with the rest of the Error naming convention for ethers.
Adds a dev-rpc feature flag to ethers-providers. This gives you a
DevRpcMiddleware
that exposesevm_snapshot
andevm_revert
for managing snapshot state.There are more methods that may be useful, but there is a bit of a mess to untangle with conflicts between documentation, hardhat, and ganache.
A lighter-weight alternative may be to just expose
provider.request()
for raw requests under a dev-rpc flag.