-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Allow block time offset to be negative (#663)
* fix: Allow block time offset to be negative * Add a changeset file * fix: Use a correct sign for block time offset * test: Add a regression test for forking blocks with future timestamps
- Loading branch information
Showing
5 changed files
with
49 additions
and
5 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 | ||
--- | ||
|
||
Allow forked block time offset to be negative |
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,36 @@ | ||
//! Allow forking blocks with future timestamps. | ||
//! | ||
//! See <https://github.com/NomicFoundation/edr/issues/588> | ||
use std::sync::Arc; | ||
|
||
use edr_provider::{ | ||
hardhat_rpc_types::ForkConfig, test_utils::create_test_config_with_fork, time::MockTime, | ||
NoopLogger, Provider, | ||
}; | ||
use edr_test_utils::env::get_alchemy_url; | ||
use tokio::runtime; | ||
|
||
#[tokio::test(flavor = "multi_thread")] | ||
async fn issue_588() -> anyhow::Result<()> { | ||
let logger = Box::new(NoopLogger); | ||
let subscriber = Box::new(|_event| {}); | ||
|
||
let early_mainnet_fork = create_test_config_with_fork(Some(ForkConfig { | ||
json_rpc_url: get_alchemy_url(), | ||
block_number: Some(2_675_000), | ||
http_headers: None, | ||
})); | ||
|
||
let current_time_is_1970 = Arc::new(MockTime::with_seconds(0)); | ||
|
||
let _forking_succeeds = Provider::new( | ||
runtime::Handle::current(), | ||
logger, | ||
subscriber, | ||
early_mainnet_fork, | ||
current_time_is_1970, | ||
)?; | ||
|
||
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 |
---|---|---|
|
@@ -11,3 +11,4 @@ mod issue_407; | |
mod issue_503; | ||
mod issue_533; | ||
mod issue_570; | ||
mod issue_588; |