-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: mining blocks when forking non-eth chains (#5127)
- Loading branch information
Showing
5 changed files
with
57 additions
and
18 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 mining of blocks when forking a chain that has non-Ethereum block headers |
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,28 @@ | ||
#![cfg(feature = "test-utils")] | ||
|
||
use edr_provider::{ | ||
hardhat_rpc_types::ForkConfig, test_utils::create_test_config_with_fork, MethodInvocation, | ||
NoopLogger, Provider, ProviderRequest, | ||
}; | ||
use edr_test_utils::env::get_infura_url; | ||
use tokio::runtime; | ||
|
||
#[tokio::test(flavor = "multi_thread")] | ||
async fn avalanche_chain_mine_local_block() -> anyhow::Result<()> { | ||
const BLOCK_NUMBER: u64 = 22_587_773; | ||
|
||
let logger = Box::new(NoopLogger); | ||
let subscriber = Box::new(|_event| {}); | ||
|
||
let config = create_test_config_with_fork(Some(ForkConfig { | ||
json_rpc_url: get_infura_url().replace("mainnet", "avalanche-mainnet"), | ||
block_number: Some(BLOCK_NUMBER), | ||
http_headers: None, | ||
})); | ||
|
||
let provider = Provider::new(runtime::Handle::current(), logger, subscriber, config)?; | ||
|
||
provider.handle_request(ProviderRequest::Single(MethodInvocation::EvmMine(None)))?; | ||
|
||
Ok(()) | ||
} |