-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use remote chain id for pre-fork simulation (#567)
* fix: use remote chain id for pre-fork simulation * Fix error message
- Loading branch information
Showing
7 changed files
with
159 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@nomicfoundation/edr": patch | ||
--- | ||
|
||
Fixed a bug in fork mode where the locally overridden chain id was used instead of the remote chain id when simulating transactions in pre-fork blocks. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use std::str::FromStr as _; | ||
|
||
use edr_eth::B256; | ||
use edr_provider::{ | ||
hardhat_rpc_types::ForkConfig, test_utils::create_test_config_with_fork, time::CurrentTime, | ||
MethodInvocation, NoopLogger, Provider, ProviderRequest, | ||
}; | ||
use edr_test_utils::env::get_alchemy_url; | ||
use tokio::runtime; | ||
|
||
// https://github.com/NomicFoundation/edr/issues/533 | ||
#[tokio::test(flavor = "multi_thread")] | ||
async fn issue_533() -> anyhow::Result<()> { | ||
let logger = Box::new(NoopLogger); | ||
let subscriber = Box::new(|_event| {}); | ||
|
||
let mut config = create_test_config_with_fork(Some(ForkConfig { | ||
json_rpc_url: get_alchemy_url(), | ||
block_number: Some(20_384_300), | ||
http_headers: None, | ||
})); | ||
|
||
// The default chain id set by Hardhat | ||
config.chain_id = 31337; | ||
|
||
let provider = Provider::new( | ||
runtime::Handle::current(), | ||
logger, | ||
subscriber, | ||
config, | ||
CurrentTime, | ||
)?; | ||
|
||
let transaction_hash = | ||
B256::from_str("0x0537316f37627655b7fe5e50e23f71cd835b377d1cde4226443c94723d036e32")?; | ||
|
||
let result = provider.handle_request(ProviderRequest::Single( | ||
MethodInvocation::DebugTraceTransaction(transaction_hash, None), | ||
))?; | ||
|
||
assert!(!result.traces.is_empty()); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ mod issue_361; | |
mod issue_384; | ||
mod issue_407; | ||
mod issue_503; | ||
mod issue_533; |