Skip to content

Commit

Permalink
chore: typo anvil_getIntervalMing -> anvil_getIntervalMining (#9292)
Browse files Browse the repository at this point in the history
chore: typo anvil_getIntervalMining
  • Loading branch information
grandizzy authored Nov 9, 2024
1 parent d2f92bc commit 896794a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion crates/anvil/core/src/eth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,10 @@ pub enum EthRequest {
SetIntervalMining(u64),

/// Gets the current mining behavior
#[cfg_attr(feature = "serde", serde(rename = "anvil_getIntervalMing", with = "empty_params"))]
#[cfg_attr(
feature = "serde",
serde(rename = "anvil_getIntervalMining", with = "empty_params")
)]
GetIntervalMining(()),

/// Removes transactions from the pool
Expand Down
6 changes: 3 additions & 3 deletions crates/anvil/src/eth/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ impl EthApi {
EthRequest::SetIntervalMining(interval) => {
self.anvil_set_interval_mining(interval).to_rpc_result()
}
EthRequest::GetIntervalMining(()) => self.anvil_get_interval_ming().to_rpc_result(),
EthRequest::GetIntervalMining(()) => self.anvil_get_interval_mining().to_rpc_result(),
EthRequest::DropTransaction(tx) => {
self.anvil_drop_transaction(tx).await.to_rpc_result()
}
Expand Down Expand Up @@ -1668,8 +1668,8 @@ impl EthApi {

/// Returns the value of mining interval, if set.
///
/// Handler for ETH RPC call: `anvil_getIntervalMing`
pub fn anvil_get_interval_ming(&self) -> Result<Option<u64>> {
/// Handler for ETH RPC call: `anvil_getIntervalMining`.
pub fn anvil_get_interval_mining(&self) -> Result<Option<u64>> {
node_info!("anvil_getIntervalMining");
Ok(self.miner.get_interval())
}
Expand Down
6 changes: 3 additions & 3 deletions crates/anvil/tests/it/anvil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ async fn test_can_change_mining_mode() {
let provider = handle.http_provider();

assert!(api.anvil_get_auto_mine().unwrap());
assert!(api.anvil_get_interval_ming().unwrap().is_none());
assert!(api.anvil_get_interval_mining().unwrap().is_none());

let num = provider.get_block_number().await.unwrap();
assert_eq!(num, 0);

api.anvil_set_interval_mining(1).unwrap();
assert!(!api.anvil_get_auto_mine().unwrap());
assert!(matches!(api.anvil_get_interval_ming().unwrap(), Some(1)));
assert!(matches!(api.anvil_get_interval_mining().unwrap(), Some(1)));
// changing the mining mode will instantly mine a new block
tokio::time::sleep(std::time::Duration::from_millis(500)).await;
let num = provider.get_block_number().await.unwrap();
Expand All @@ -32,7 +32,7 @@ async fn test_can_change_mining_mode() {
// assert that no block is mined when the interval is set to 0
api.anvil_set_interval_mining(0).unwrap();
assert!(!api.anvil_get_auto_mine().unwrap());
assert!(api.anvil_get_interval_ming().unwrap().is_none());
assert!(api.anvil_get_interval_mining().unwrap().is_none());
tokio::time::sleep(std::time::Duration::from_millis(1000)).await;
let num = provider.get_block_number().await.unwrap();
assert_eq!(num, 1);
Expand Down

0 comments on commit 896794a

Please sign in to comment.