Skip to content

Commit

Permalink
test: enable validate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zsluedem committed May 27, 2023
1 parent 8e296d4 commit ecaed3e
Show file tree
Hide file tree
Showing 5 changed files with 176 additions and 85 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ rust-version = "1.69.0"
[dev-dependencies]
aa-bundler-contracts = { path = "../crates/contracts" }
aa-bundler-primitives = { path = "../crates/primitives" }
aa-bundler-uopool = { path = "../crates/uopool" }

anyhow = "1"
ethers = { workspace = true }
Expand Down
4 changes: 4 additions & 0 deletions tests/src/common/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ abigen!(
TracerTest,
"$CARGO_WORKSPACE_DIR/thirdparty/bundler/packages/bundler/artifacts/contracts/tests/TracerTest.sol/TracerTest.json"
);
abigen!(
TestCoin,
"$CARGO_WORKSPACE_DIR/thirdparty/bundler/packages/bundler/artifacts/contracts/tests/TestCoin.sol/TestCoin.json"
);
16 changes: 13 additions & 3 deletions tests/src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ use ethers::{
use tempdir::TempDir;

use self::gen::{
EntryPointContract, TestOpcodesAccount, TestOpcodesAccountFactory, TestRecursionAccount,
TestRulesAccountFactory, TestStorageAccount, TestStorageAccountFactory, TracerTest,
EntryPointContract, TestCoin, TestOpcodesAccount, TestOpcodesAccountFactory,
TestRecursionAccount, TestRulesAccountFactory, TestStorageAccount, TestStorageAccountFactory,
TracerTest,
};
pub mod gen;

Expand Down Expand Up @@ -67,8 +68,9 @@ pub async fn deploy_test_opcode_account_factory<M: Middleware + 'static>(

pub async fn deploy_test_storage_account_factory<M: Middleware + 'static>(
client: Arc<M>,
test_coin_addr: Address,
) -> anyhow::Result<DeployedContract<TestStorageAccountFactory<M>>> {
let (factory, receipt) = TestStorageAccountFactory::deploy(client, ())?
let (factory, receipt) = TestStorageAccountFactory::deploy(client, test_coin_addr)?
.send_with_receipt()
.await?;
let address = receipt.contract_address.unwrap();
Expand Down Expand Up @@ -114,6 +116,14 @@ pub async fn deploy_tracer_test<M: Middleware + 'static>(
Ok(DeployedContract::new(factory, address))
}

pub async fn deploy_test_coin<M: Middleware + 'static>(
client: Arc<M>,
) -> anyhow::Result<DeployedContract<TestCoin<M>>> {
let (factory, receipt) = TestCoin::deploy(client, ())?.send_with_receipt().await?;
let address = receipt.contract_address.unwrap();
Ok(DeployedContract::new(factory, address))
}

pub async fn sign(
user_op: &mut UserOperation,
entry_point_address: &Address,
Expand Down
Loading

0 comments on commit ecaed3e

Please sign in to comment.