Skip to content

Commit

Permalink
chore: resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dutterbutter committed Dec 19, 2024
2 parents 6e7b2b5 + 3c5529f commit 58b0ccf
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ rust-doc:
# Lint checks for Rust code
lint:
cd e2e-tests && yarn && yarn lint && yarn fmt && yarn typecheck
cd e2e-tests-rust && cargo fmt --all -- --check
cd spec-tests && cargo fmt --all -- --check
cargo fmt --all -- --check
cargo clippy --tests -p anvil-zksync -Zunstable-options -- -D warnings --allow clippy::unwrap_used
cd e2e-tests-rust && cargo clippy --tests -Zunstable-options -- -D warnings --allow clippy::unwrap_used
cd spec-tests && cargo clippy --tests -Zunstable-options -- -D warnings --allow clippy::unwrap_used

# Fix lint errors for Rust code
lint-fix:
Expand Down
1 change: 1 addition & 0 deletions e2e-tests-rust/src/provider/anvil_zksync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use alloy::transports::Transport;
use alloy_zksync::network::Zksync;

/// RPC interface that gives access to methods specific to anvil-zksync.
#[allow(clippy::type_complexity)]
pub trait AnvilZKsyncApi<T>: Provider<T, Zksync>
where
T: Transport + Clone,
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests-rust/src/provider/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub async fn init_testing_provider_with_client(
let http = HttpWithMiddleware::with_client(client, url.clone());
let rpc_client = RpcClient::new(http, true);

let rich_accounts = node_layer.instance().addresses().iter().cloned().collect();
let rich_accounts = node_layer.instance().addresses().to_vec();
let default_keys = node_layer.instance().keys().to_vec();
let (default_key, remaining_keys) = default_keys.split_first().ok_or(NoKeysAvailable)?;

Expand Down
8 changes: 4 additions & 4 deletions e2e-tests-rust/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@ async fn no_sealing_timeout() -> anyhow::Result<()> {
async fn dynamic_sealing_mode() -> anyhow::Result<()> {
// Test that we can successfully switch between different sealing modes
let provider = init_testing_provider(|node| node.no_mine()).await?;
assert_eq!(provider.anvil_get_auto_mine().await?, false);
assert!(!(provider.anvil_get_auto_mine().await?));

// Enable immediate block sealing
provider.anvil_set_auto_mine(true).await?;
assert_eq!(provider.anvil_get_auto_mine().await?, true);
assert!(provider.anvil_get_auto_mine().await?);

// Check that we can finalize transactions now
let receipt = provider.tx().finalize().await?;
assert!(receipt.status());

// Enable interval block sealing
provider.anvil_set_interval_mining(3).await?;
assert_eq!(provider.anvil_get_auto_mine().await?, false);
assert!(!(provider.anvil_get_auto_mine().await?));

// Check that we can finalize two txs in the same block now
provider
Expand All @@ -99,7 +99,7 @@ async fn dynamic_sealing_mode() -> anyhow::Result<()> {

// Disable block sealing entirely
provider.anvil_set_auto_mine(false).await?;
assert_eq!(provider.anvil_get_auto_mine().await?, false);
assert!(!(provider.anvil_get_auto_mine().await?));

// Check that transactions do not get finalized now
provider
Expand Down
4 changes: 2 additions & 2 deletions spec-tests/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl AnvilZKsyncRunner {
let path = match self.path {
Some(path) => path,
None => {
if let Some(path) = std::env::var("ANVIL_ZKSYNC_BINARY_PATH").ok() {
if let Ok(path) = std::env::var("ANVIL_ZKSYNC_BINARY_PATH") {
path
} else {
// Default to the binary taken from the target directory
Expand All @@ -140,7 +140,7 @@ impl AnvilZKsyncRunner {
let rpc_port_lock = match self.rpc_port {
Some(rpc_port) => LockedPort::acquire(rpc_port).await?,
None => {
if let Some(rpc_port) = std::env::var("ANVIL_ZKSYNC_RPC_PORT").ok() {
if let Ok(rpc_port) = std::env::var("ANVIL_ZKSYNC_RPC_PORT") {
LockedPort::acquire(rpc_port.parse().context(
"failed to parse `ANVIL_ZKSYNC_RPC_PORT` var as a valid port number",
)?)
Expand Down
2 changes: 1 addition & 1 deletion spec-tests/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn resolve_method_spec(method_name: &str) -> anyhow::Result<Method> {
None
}
})
.expect(&format!("method '{method_name}' not found"));
.unwrap_or_else(|| panic!("method '{method_name}' not found"));
Ok(method)
}

Expand Down

0 comments on commit 58b0ccf

Please sign in to comment.