diff --git a/crates/anvil/src/eth/api.rs b/crates/anvil/src/eth/api.rs index 20ac92234f27..81990d75558b 100644 --- a/crates/anvil/src/eth/api.rs +++ b/crates/anvil/src/eth/api.rs @@ -1697,12 +1697,12 @@ impl EthApi { // mine all the blocks for _ in 0..blocks.to::() { - self.mine_one().await; - // If we have an interval, jump forwards in time to the "next" timestamp if let Some(interval) = interval { self.backend.time().increase_time(interval); } + + self.mine_one().await; } Ok(()) diff --git a/crates/anvil/tests/it/anvil_api.rs b/crates/anvil/tests/it/anvil_api.rs index da5372c7edb3..ce78d72ca59a 100644 --- a/crates/anvil/tests/it/anvil_api.rs +++ b/crates/anvil/tests/it/anvil_api.rs @@ -1009,3 +1009,21 @@ async fn test_mine_blks_with_same_timestamp() { // timestamps should be equal assert_eq!(blks, vec![init_timestamp; 4]); } + +// +#[tokio::test(flavor = "multi_thread")] +async fn test_mine_first_block_with_interval() { + let (api, _) = spawn(NodeConfig::test()).await; + + let init_block = api.block_by_number(0.into()).await.unwrap().unwrap(); + let init_timestamp = init_block.header.timestamp; + + // Mine 2 blocks with interval of 60. + let _ = api.anvil_mine(Some(U256::from(2)), Some(U256::from(60))).await; + + let first_block = api.block_by_number(1.into()).await.unwrap().unwrap(); + assert_eq!(first_block.header.timestamp, init_timestamp + 60); + + let second_block = api.block_by_number(2.into()).await.unwrap().unwrap(); + assert_eq!(second_block.header.timestamp, init_timestamp + 120); +} diff --git a/crates/cast/src/lib.rs b/crates/cast/src/lib.rs index 97624c12ab64..bfa33c6e93f8 100644 --- a/crates/cast/src/lib.rs +++ b/crates/cast/src/lib.rs @@ -128,7 +128,7 @@ where /// # Ok(()) /// # } /// ``` - pub async fn call<'a>( + pub async fn call( &self, req: &WithOtherFields, func: Option<&Function>,