Skip to content

Commit ef86434

Browse files
committed
chore: run tests with zksyncos server
1 parent 9e0fce9 commit ef86434

File tree

41 files changed

+1288
-197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1288
-197
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
#Cargo.lock
1+
zksync-os-server
2+
account-abstraction

packages/sdk-platforms/rust/zksync-sso-erc4337/Cargo.lock

Lines changed: 76 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/sdk-platforms/rust/zksync-sso-erc4337/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,5 @@ tempfile = "3"
9797
strip-ansi-escapes = "0.2"
9898
libc = "0.2"
9999

100+
# Misc
101+
ureq = "2.10"

packages/sdk-platforms/rust/zksync-sso-erc4337/crates/zksync-sso-erc4337-core/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ base64.workspace = true
4949
libc = { workspace = true, optional = true }
5050
strip-ansi-escapes = { workspace = true, optional = true }
5151
tempfile = { workspace = true, optional = true }
52+
zksync-sso-zksyncos-node = { path = "../zksync-sso-zksyncos-node", optional = true }
5253

5354
# Explicitly add getrandom v0.2 with js feature for WASM (used by rand 0.8 from alloy)
5455
[target.'cfg(target_arch = "wasm32")'.dependencies]
@@ -60,7 +61,7 @@ web-sys = { version = "0.3", features = ["Window"] }
6061
[features]
6162
default = ["tokio-runtime"]
6263
tokio-runtime = ["tokio"]
63-
test-utilities = ["libc", "strip-ansi-escapes", "tempfile"]
64+
test-utilities = ["libc", "strip-ansi-escapes", "tempfile", "zksync-sso-zksyncos-node"]
6465

6566
[dev-dependencies]
6667
# Alloy
@@ -77,3 +78,4 @@ tempfile.workspace = true
7778
strip-ansi-escapes.workspace = true
7879
libc.workspace = true
7980
wiremock.workspace = true
81+
zksync-sso-zksyncos-node = { path = "../zksync-sso-zksyncos-node" }

packages/sdk-platforms/rust/zksync-sso-erc4337/crates/zksync-sso-erc4337-core/src/erc4337/account/erc7579/module/add.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ mod tests {
122122
signer::create_eoa_signer,
123123
},
124124
utils::alloy_utilities::test_utilities::{
125-
TestInfraConfig,
126-
start_anvil_and_deploy_contracts_and_start_bundler_with_config,
125+
config::TestInfraConfig,
126+
start_node_and_deploy_contracts_and_start_bundler_with_config,
127127
},
128128
};
129129
use alloy::primitives::address;
@@ -139,11 +139,8 @@ mod tests {
139139
bundler,
140140
bundler_client,
141141
) = {
142-
let signer_private_key = "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6".to_string();
143-
let config = TestInfraConfig {
144-
signer_private_key: signer_private_key.clone(),
145-
};
146-
start_anvil_and_deploy_contracts_and_start_bundler_with_config(
142+
let config = TestInfraConfig::rich_wallet_9();
143+
start_node_and_deploy_contracts_and_start_bundler_with_config(
147144
&config,
148145
)
149146
.await?
@@ -239,11 +236,8 @@ mod tests {
239236
bundler,
240237
bundler_client,
241238
) = {
242-
let signer_private_key = "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6".to_string();
243-
let config = TestInfraConfig {
244-
signer_private_key: signer_private_key.clone(),
245-
};
246-
start_anvil_and_deploy_contracts_and_start_bundler_with_config(
239+
let config = TestInfraConfig::rich_wallet_9();
240+
start_node_and_deploy_contracts_and_start_bundler_with_config(
247241
&config,
248242
)
249243
.await?

packages/sdk-platforms/rust/zksync-sso-erc4337/crates/zksync-sso-erc4337-core/src/erc4337/account/modular_smart_account/deploy.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ mod tests {
242242
signer::{Signer, create_eoa_signer},
243243
},
244244
utils::alloy_utilities::test_utilities::{
245-
TestInfraConfig, start_anvil_and_deploy_contracts,
246-
start_anvil_and_deploy_contracts_and_start_bundler_with_config,
245+
config::TestInfraConfig, start_node_and_deploy_contracts,
246+
start_node_and_deploy_contracts_and_start_bundler_with_config,
247247
},
248248
};
249249
use alloy::{
@@ -254,9 +254,9 @@ mod tests {
254254
use std::{future::Future, pin::Pin, str::FromStr, sync::Arc};
255255

256256
#[tokio::test]
257-
async fn test_deploy_account_basic() -> eyre::Result<()> {
257+
async fn test_deploy_account() -> eyre::Result<()> {
258258
let (_, anvil_instance, provider, contracts, _) =
259-
start_anvil_and_deploy_contracts().await?;
259+
start_node_and_deploy_contracts().await?;
260260

261261
let factory_address = contracts.account_factory;
262262

@@ -278,7 +278,7 @@ mod tests {
278278
#[tokio::test]
279279
async fn test_deploy_account_with_eoa_signer() -> eyre::Result<()> {
280280
let (_, anvil_instance, provider, contracts, _) =
281-
start_anvil_and_deploy_contracts().await?;
281+
start_node_and_deploy_contracts().await?;
282282

283283
let factory_address = contracts.account_factory;
284284
let eoa_validator_address = contracts.eoa_validator;
@@ -320,7 +320,7 @@ mod tests {
320320
#[tokio::test]
321321
async fn test_deploy_account_with_session_validator() -> eyre::Result<()> {
322322
let (_, anvil_instance, provider, contracts, _) =
323-
start_anvil_and_deploy_contracts().await?;
323+
start_node_and_deploy_contracts().await?;
324324

325325
let factory_address = contracts.account_factory;
326326
let session_validator_address = contracts.session_validator;
@@ -363,7 +363,7 @@ mod tests {
363363
#[tokio::test]
364364
async fn test_deploy_account_with_eoa_and_session() -> eyre::Result<()> {
365365
let (_, anvil_instance, provider, contracts, _) =
366-
start_anvil_and_deploy_contracts().await?;
366+
start_node_and_deploy_contracts().await?;
367367

368368
let factory_address = contracts.account_factory;
369369
let eoa_validator_address = contracts.eoa_validator;
@@ -438,11 +438,8 @@ mod tests {
438438
bundler,
439439
bundler_client,
440440
) = {
441-
let signer_private_key = "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6".to_string();
442-
let config = TestInfraConfig {
443-
signer_private_key: signer_private_key.clone(),
444-
};
445-
start_anvil_and_deploy_contracts_and_start_bundler_with_config(
441+
let config = TestInfraConfig::rich_wallet_9();
442+
start_node_and_deploy_contracts_and_start_bundler_with_config(
446443
&config,
447444
)
448445
.await?

packages/sdk-platforms/rust/zksync-sso-erc4337/crates/zksync-sso-erc4337-core/src/erc4337/account/modular_smart_account/deploy/user_op.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ mod tests {
130130
signer::create_eoa_signer,
131131
},
132132
utils::alloy_utilities::test_utilities::{
133-
TestInfraConfig,
134-
start_anvil_and_deploy_contracts_and_start_bundler_with_config,
133+
config::TestInfraConfig,
134+
start_node_and_deploy_contracts_and_start_bundler_with_config,
135135
},
136136
};
137137
use alloy::primitives::{U256, address};
138138

139139
#[tokio::test]
140-
async fn test_deploy_account_with_user_op_basic() -> eyre::Result<()> {
140+
async fn test_deploy_account_with_user_op() -> eyre::Result<()> {
141141
let (
142142
_,
143143
anvil_instance,
@@ -146,15 +146,10 @@ mod tests {
146146
signer_private_key,
147147
bundler,
148148
bundler_client,
149-
) = {
150-
let signer_private_key = "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6".to_string();
151-
start_anvil_and_deploy_contracts_and_start_bundler_with_config(
152-
&TestInfraConfig {
153-
signer_private_key: signer_private_key.clone(),
154-
},
155-
)
156-
.await?
157-
};
149+
) = start_node_and_deploy_contracts_and_start_bundler_with_config(
150+
&TestInfraConfig::rich_wallet_9(),
151+
)
152+
.await?;
158153

159154
let entry_point_address =
160155
address!("0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108");

packages/sdk-platforms/rust/zksync-sso-erc4337/crates/zksync-sso-erc4337-core/src/erc4337/account/modular_smart_account/guardian/accept.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ mod tests {
5656
utils::alloy_utilities::{
5757
ethereum_wallet_from_private_key,
5858
test_utilities::{
59-
TestInfraConfig,
60-
start_anvil_and_deploy_contracts_and_start_bundler_with_config,
59+
config::TestInfraConfig,
60+
start_node_and_deploy_contracts_and_start_bundler_with_config,
6161
},
6262
},
6363
};
@@ -74,11 +74,8 @@ mod tests {
7474
bundler,
7575
bundler_client,
7676
) = {
77-
let signer_private_key = "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6".to_string();
78-
let config = TestInfraConfig {
79-
signer_private_key: signer_private_key.clone(),
80-
};
81-
start_anvil_and_deploy_contracts_and_start_bundler_with_config(
77+
let config = TestInfraConfig::rich_wallet_9();
78+
start_node_and_deploy_contracts_and_start_bundler_with_config(
8279
&config,
8380
)
8481
.await?

packages/sdk-platforms/rust/zksync-sso-erc4337/crates/zksync-sso-erc4337-core/src/erc4337/account/modular_smart_account/guardian/propose.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ mod tests {
100100
signer::create_eoa_signer,
101101
},
102102
utils::alloy_utilities::test_utilities::{
103-
TestInfraConfig,
104-
start_anvil_and_deploy_contracts_and_start_bundler_with_config,
103+
config::TestInfraConfig,
104+
start_node_and_deploy_contracts_and_start_bundler_with_config,
105105
},
106106
};
107107
use alloy::primitives::address;
@@ -117,11 +117,8 @@ mod tests {
117117
bundler,
118118
bundler_client,
119119
) = {
120-
let signer_private_key = "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6".to_string();
121-
let config = TestInfraConfig {
122-
signer_private_key: signer_private_key.clone(),
123-
};
124-
start_anvil_and_deploy_contracts_and_start_bundler_with_config(
120+
let config = TestInfraConfig::rich_wallet_9();
121+
start_node_and_deploy_contracts_and_start_bundler_with_config(
125122
&config,
126123
)
127124
.await?

packages/sdk-platforms/rust/zksync-sso-erc4337/crates/zksync-sso-erc4337-core/src/erc4337/account/modular_smart_account/guardian/recovery/finalize.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ mod tests {
7171
utils::alloy_utilities::{
7272
ethereum_wallet_from_private_key,
7373
test_utilities::{
74-
TestInfraConfig,
75-
start_anvil_and_deploy_contracts_and_start_bundler_with_config,
74+
config::TestInfraConfig,
75+
start_node_and_deploy_contracts_and_start_bundler_with_config,
7676
},
7777
},
7878
};
@@ -91,11 +91,8 @@ mod tests {
9191
bundler,
9292
bundler_client,
9393
) = {
94-
let signer_private_key = "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6".to_string();
95-
let config = TestInfraConfig {
96-
signer_private_key: signer_private_key.clone(),
97-
};
98-
start_anvil_and_deploy_contracts_and_start_bundler_with_config(
94+
let config = TestInfraConfig::rich_wallet_9();
95+
start_node_and_deploy_contracts_and_start_bundler_with_config(
9996
&config,
10097
)
10198
.await?

0 commit comments

Comments
 (0)