From 3e3c6251c3753b6688942cf5e49b583d6053688f Mon Sep 17 00:00:00 2001 From: MistApproach Date: Thu, 29 Aug 2024 10:10:25 +0200 Subject: [PATCH 1/3] fix: Anvil builder default port --- crates/node-bindings/src/anvil.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/node-bindings/src/anvil.rs b/crates/node-bindings/src/anvil.rs index 21028610210..c203091b9f9 100644 --- a/crates/node-bindings/src/anvil.rs +++ b/crates/node-bindings/src/anvil.rs @@ -291,7 +291,7 @@ impl Anvil { pub fn try_spawn(self) -> Result { let mut cmd = self.program.as_ref().map_or_else(|| Command::new("anvil"), Command::new); cmd.stdout(std::process::Stdio::piped()).stderr(std::process::Stdio::inherit()); - let mut port = self.port.unwrap_or_default(); + let mut port = self.port.unwrap_or(8545u16); cmd.arg("-p").arg(port.to_string()); if let Some(mnemonic) = self.mnemonic { @@ -417,4 +417,10 @@ mod tests { let anvil = Anvil::new().spawn(); assert_eq!(anvil.chain_id(), 31337); } + + #[test] + fn assert_default_port() { + let anvil = Anvil::new().spawn(); + assert_eq!(anvil.port(), 8545); + } } From 1da0b9b72ac3b77dba29ecdb7a35b35c24488d54 Mon Sep 17 00:00:00 2001 From: MistApproach Date: Sat, 31 Aug 2024 19:21:10 +0200 Subject: [PATCH 2/3] revert: Anvil builder default port --- crates/node-bindings/src/anvil.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/crates/node-bindings/src/anvil.rs b/crates/node-bindings/src/anvil.rs index c203091b9f9..21028610210 100644 --- a/crates/node-bindings/src/anvil.rs +++ b/crates/node-bindings/src/anvil.rs @@ -291,7 +291,7 @@ impl Anvil { pub fn try_spawn(self) -> Result { let mut cmd = self.program.as_ref().map_or_else(|| Command::new("anvil"), Command::new); cmd.stdout(std::process::Stdio::piped()).stderr(std::process::Stdio::inherit()); - let mut port = self.port.unwrap_or(8545u16); + let mut port = self.port.unwrap_or_default(); cmd.arg("-p").arg(port.to_string()); if let Some(mnemonic) = self.mnemonic { @@ -417,10 +417,4 @@ mod tests { let anvil = Anvil::new().spawn(); assert_eq!(anvil.chain_id(), 31337); } - - #[test] - fn assert_default_port() { - let anvil = Anvil::new().spawn(); - assert_eq!(anvil.port(), 8545); - } } From 00051e4f1c0cc45e8846ac86453729a0e15bd820 Mon Sep 17 00:00:00 2001 From: MistApproach Date: Sat, 31 Aug 2024 19:23:17 +0200 Subject: [PATCH 3/3] docs: update Anvil default port --- crates/node-bindings/src/anvil.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/node-bindings/src/anvil.rs b/crates/node-bindings/src/anvil.rs index 21028610210..0572cf0fdd1 100644 --- a/crates/node-bindings/src/anvil.rs +++ b/crates/node-bindings/src/anvil.rs @@ -164,7 +164,7 @@ pub struct Anvil { impl Anvil { /// Creates an empty Anvil builder. - /// The default port is 8545. The mnemonic is chosen randomly. + /// The default port and the mnemonic are chosen randomly. /// /// # Example ///